Skip to content
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

Improve WKBReader error checking #675

Merged
merged 2 commits into from
Jan 29, 2021

Conversation

dr-jts
Copy link
Contributor

@dr-jts dr-jts commented Jan 28, 2021

This improves the error checking in the WKBReader to detect field values which are out of range. The fields checked are numElems, numRings and numCoords. They are checked to ensure they are > 0 and less than MAX_INT, and that they are less than the maximum size of the WKB data (if known). This should prevent NegativeArraySizeException and OutOfMemoryError errors being caused by malformed or malicious WKB values.

Fixes #67.

Signed-off-by: Martin Davis mtnclimb@gmail.com

Signed-off-by: Martin Davis <mtnclimb@gmail.com>
Signed-off-by: Martin Davis <mtnclimb@gmail.com>
@dr-jts dr-jts changed the title Handle errors caused by reading malformed WKB Improve WKBReader error checking Jan 29, 2021
@dr-jts dr-jts merged commit 1353dcf into locationtech:master Jan 29, 2021
@dr-jts dr-jts deleted the fix-wkb-malformed-errors branch January 29, 2021 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WKBReader vulnerable to malformed input
1 participant