Merge pull request #376 from jwrdegoede/oss-fuzz-36187-null-ptr-deref-fix

Fix null-ptr deref when table->map_sz is 0
This commit is contained in:
Evan Miller
2022-01-25 10:24:14 -05:00
committed by GitHub

View File

@@ -92,6 +92,12 @@ MdbTableDef *mdb_read_table(MdbCatalogEntry *entry)
mdb_free_tabledef(table);
return NULL;
}
/* First byte of usage_map is the map-type and must always be present */
if (table->map_sz < 1) {
fprintf(stderr, "mdb_read_table: invalid map-size: %zu\n", table->map_sz);
mdb_free_tabledef(table);
return NULL;
}
table->usage_map = g_memdup2((char*)buf + row_start, table->map_sz);
if (mdb_get_option(MDB_DEBUG_USAGE))
mdb_buffer_dump(buf, row_start, table->map_sz);