Fix infinite loop (See oss-fuzz/28789)

A loop is still possible with mutually referencing pages but eliminating
self-references should fix the major timeouts
This commit is contained in:
Evan Miller 2021-01-07 21:29:37 -05:00
parent c0880f0e40
commit 7893a948ce

View File

@ -411,6 +411,8 @@ int mdb_read_next_dpg(MdbTableDef *table)
break; /* unknow map type: goto fallback */
if (!next_pg)
return 0;
if ((guint32)next_pg == table->cur_phys_pg)
return 0; /* Infinite loop */
if (!mdb_read_pg(mdb, next_pg)) {
fprintf(stderr, "error: reading page %d failed.\n", next_pg);