-
Notifications
You must be signed in to change notification settings - Fork 134
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
Bugs in decoder found by fuzzing #64
Comments
cc @kyeah |
nice, thanks 🙇 Gonna use this as a tracking issue instead of splitting it out since this seems like a nice concise set.
|
It looks like chrono comes with a timestamp_opt method that would allow you to capture the error instead of allowing chrono to panic. |
@neosilky Is this what you are expecting? :) |
@zonyitoo Yes - nice job! So I'm still hitting the |
That's weird...
What should I do for length = 0? ... Hmmm.... Can you dump the original binary data? |
It seems that the Go's implementation will also crash in this case: https://github.com/go-mgo/mgo/blob/v2/bson/decode.go#L771-L772 . The official Python BSON implementation will raise an exception: https://github.com/mongodb/mongo-python-driver/blob/master/bson/__init__.py#L175-L178 . |
It won't panic now. But return a DecoderError. |
@zonyitoo Nice one, it looks like you've done a sane thing 😀 I'm now getting one weird memory issue and a |
Ahh.. the |
@neosilky This commit should fix the issue. |
Wait a minute...
@neosilky Can you give me a BSON encoded buffer, which can reproduce |
Ah my fault.... the |
Fixed. And close. |
Thanks! |
Found the following:
From:
chrono-0.2.25/src/offset/mod.rs:151
viasrc/decoder/mod.rs:172
src/decoder/mod.rs:172
src/decoder/mod.rs:45
Full logs: https://gist.github.com/killercup/5e8623e0d8b0fe9868b45eb223ef51d8 (See last few lines for inputs used, in bytes or base64)
See rust-fuzz/targets#51 for sources, I ran it with
$ env ASAN_OPTIONS="detect_odr_violation=0 allocator_may_return_null=1" ./run-fuzzer.sh bson read_bson
cc rust-fuzz/targets#39
The text was updated successfully, but these errors were encountered: