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

Integer overflow when parsing JSON #75

Closed
frewsxcv opened this issue May 16, 2015 · 1 comment
Closed

Integer overflow when parsing JSON #75

frewsxcv opened this issue May 16, 2015 · 1 comment
Labels

Comments

@frewsxcv
Copy link
Contributor

Code

#![feature(plugin)]
#![plugin(afl_coverage_plugin)]

extern crate afl_coverage;

extern crate serde;

use std::io::{self, Read, Cursor};

use serde::json::{self, Value};


fn main() {
    let mut input = String::new();
    let result = io::stdin().read_to_string(&mut input);
    if result.is_ok() {
        let _: Result<Value, _> = json::from_str(&input);
    }
}

Input

777777777777777777777777777

Crash

root@vultr:~/afl-staging-area2# cargo run < outputs/crashes/id\:000000\,sig\:04\,src\:000000\,op\:havoc\,rep\:16
     Running `target/debug/afl-staging-area2`
thread '<main>' panicked at 'arithmetic operation overflowed', /root/serde/src/json/de.rs:201
An unknown error occurred

To learn more, run the command again with --verbose.

This bug was found using https://github.com/kmcallister/afl.rs 👍

@erickt
Copy link
Member

erickt commented May 19, 2015

Thanks for finding this!

@erickt erickt closed this as completed in e6776ff May 19, 2015
@dtolnay dtolnay added the bug label May 14, 2016
rubdos pushed a commit to rubdos/serde that referenced this issue Jun 20, 2017
Vendor deprecated/unstable traits from std::num
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants