mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-04-05 04:17:06 +08:00
Merge pull request #377 from jwrdegoede/oss-fuzz-35972-null-ptr-deref-fix
Always check mdb_read_table() return value
This commit is contained in:
commit
ff085816b2
@ -872,6 +872,10 @@ generate_table_schema(FILE *outfile, MdbCatalogEntry *entry, char *dbnamespace,
|
||||
fprintf (outfile, " (\n");
|
||||
|
||||
table = mdb_read_table (entry);
|
||||
if (!table) {
|
||||
fprintf(stderr, "Error: Table %s does not exist\n", entry->object_name);
|
||||
return;
|
||||
}
|
||||
|
||||
/* get the columns */
|
||||
mdb_read_columns(table);
|
||||
|
@ -361,6 +361,9 @@ unsigned int i, bitn;
|
||||
guint32 pgnum;
|
||||
|
||||
table = mdb_read_table(entry);
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
fprintf(stdout,"definition page = %lu\n",entry->table_pg);
|
||||
fprintf(stdout,"number of datarows = %d\n",table->num_rows);
|
||||
fprintf(stdout,"number of columns = %d\n",table->num_cols);
|
||||
|
@ -92,6 +92,11 @@ FILE *cfile;
|
||||
entry->object_name, entry->object_name);
|
||||
fprintf (cfile, "\tfprintf (stdout, \"**************** %s ****************\\n\");\n", entry->object_name);
|
||||
table = mdb_read_table (entry);
|
||||
if (!table) {
|
||||
fprintf(stderr, "Error: Table %s does not exist in this database.\n", entry->object_name);
|
||||
/* Don't bother clean up memory before exit */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* get the columns */
|
||||
mdb_read_columns (table);
|
||||
|
Loading…
Reference in New Issue
Block a user