mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-04-05 20:31:00 +08:00
Always check mdb_read_table() return value
A couple of places were missing NULL return value checks for mdb_read_table()'s return value. Add these. This fixes a NULL pointer deref while running ./test_script.sh on the test mdb file from oss-fuzz/35972 . Note this does NOT fix the original problem reported in oss-fuzz/35972 which reports a "Dynamic-stack-buffer-overflow WRITE 16" issue, which I've been unable to reproduce.
This commit is contained in:
parent
2da65ffdb3
commit
03391fc913
src
@ -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