Skip to content

Fix crash on corrupt field number in FieldsReader::doc()#231

Open
Johnson-zs wants to merge 1 commit into
luceneplusplus:masterfrom
Johnson-zs:master
Open

Fix crash on corrupt field number in FieldsReader::doc()#231
Johnson-zs wants to merge 1 commit into
luceneplusplus:masterfrom
Johnson-zs:master

Conversation

@Johnson-zs

Copy link
Copy Markdown
Contributor

FieldsReader::doc() did not validate the field number read from the
stored fields stream. When a corrupted index contained an invalid
field number, the subsequent fieldInfo lookup returned a null pointer,
causing a null-pointer dereference crash.

Throw CorruptIndexException when the field number has no matching
FieldInfo entry. Add a unit test (testCorruptFieldNumber) that
constructs a corrupted fields file with an invalid VInt field number
and verifies the exception is raised.

FieldsReader::doc() did not validate the field number read from the
stored fields stream. When a corrupted index contained an invalid
field number, the subsequent fieldInfo lookup returned a null pointer,
causing a null-pointer dereference crash.

Throw CorruptIndexException when the field number has no matching
FieldInfo entry. Add a unit test (testCorruptFieldNumber) that
constructs a corrupted fields file with an invalid VInt field number
and verifies the exception is raised.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant