Repository navigation
Reject extended type byte 0 in the pure Python reader #499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+62
−16
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cd4496b
Reject extended type byte 0 in pure Python reader
oschwald cf9b2db
Inline the extended type read in _decode
oschwald 2896d9b
Check data_end before reading the extended type byte
oschwald fa653a5
Use one message for invalid extended type bytes
oschwald 493861d
Test extended type bytes 5, 6 and 255
oschwald 6800b21
Test extended type byte 0 in each reader mode
oschwald File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test calls only
Decoder. No reader-level test runs in every mode to check theHISTORY.rstclaim that the C extension still decodes byte 0 as a map. If the vendored libmaxminddb starts to reject byte 0, or the pure Python reader accepts it again, no test fails, and theHISTORY.rstentry becomes false. TheMODE_FILEandMODE_MMAPreader paths are also not tested for this byte.The
_database(records, ip_version=..., data=...)helper intests/reader_test.pycan build a small database for a test that runs in each mode.🤖 Comment by Claude Opus 5.5.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in 6800b21.
test_extended_type_byte_0builds a database with_databaseand runs in each mode. The pure Python modes must raiseInvalidDatabaseError, and the C extension with the bundled libmaxminddb must return{}. If the bundled libmaxminddb starts to reject the byte, the test fails. With a system libmaxminddb (MAXMINDDB_USE_SYSTEM_LIBMAXMINDDB), the test also acceptsInvalidDatabaseError, because a newer system library can already reject it.🤖 Claude Code (an AI agent) wrote this reply on behalf of @oschwald.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially skipped this as
libmaxminddbhas not been updated and it seemed like the decoder test was sufficient.