Improve fix for invalid Btree level count
commit61249b067d1477cc099df342ada2f96b24822f42
authorOlly Betts <olly@survex.com>
Fri, 19 Jan 2024 01:32:27 +0000 (19 14:32 +1300)
committerOlly Betts <olly@survex.com>
Fri, 19 Jan 2024 02:47:07 +0000 (19 15:47 +1300)
treea2ceb884d1bc2888abeb0eae7aa94364663d2a29
parent5622149ef84710a44960f38f95fe6099b8dbc33a
Improve fix for invalid Btree level count

With the previous fix we still accessed an out of range value when
destroying the database (but for some reason neither valgrind nor
ubsan detect this).

Instead reject out of range values as we decode them from disk.

See #824.

(cherry picked from commit 44aaa6fdfdccb4f2708da0605fa6efcc327d7908)
xapian-core/backends/glass/glass_defs.h
xapian-core/backends/glass/glass_table.cc
xapian-core/backends/glass/glass_table.h
xapian-core/backends/glass/glass_version.cc
xapian-core/tests/Makefile.am
xapian-core/tests/api_backend.cc
xapian-core/tests/testdata/glass_corrupt_level_db1 [copied from xapian-core/tests/testdata/glass_corrupt_level_db with 100% similarity]
xapian-core/tests/testdata/glass_corrupt_level_db2 [moved from xapian-core/tests/testdata/glass_corrupt_level_db with 96% similarity]