Skip to content

Commit

Permalink
Merge pull request #40 from fitzgen/fuzzing
Browse files Browse the repository at this point in the history
Fuzzing + random stuff
  • Loading branch information
fitzgen committed Feb 2, 2017
2 parents ce23e7f + d6706be commit 64afc30
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target
Cargo.lock
*.rs.bk
out
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-103
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z11CallObjFuncIN2js9MapObject12IteratorKindEEbPFbP9JSContextT_N2JS6HandleIP8JSObjectEENS6_13MutableHandleINS6_5ValueEEEES4_S5_SA_SD_
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-196
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z13ConvertToBaseIPN2js21DebugEnvironmentProxyEEPN13PtrBaseGCTypeIT_E4typeEPS4_
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-236
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z14EmitSimdBinaryIN2js3jit18MSimdBinaryBitwise9OperationEEbRN12_GLOBAL__N_116FunctionCompilerENS0_4wasm7ValTypeET_
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-251
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z14JS_SetPropertyP9JSContextN2JS6HandleIP8JSObjectEEPKcNS2_INS1_5ValueEEE
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-340
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z16DispatchToTracerIPN2js3jit7JitCodeEEvP8JSTracerPT_PKc
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-357
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z16JS_ExecuteRegExpP9JSContextN2JS6HandleIP8JSObjectEES5_PDsmPmbNS1_13MutableHandleINS1_5ValueEEE
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-378
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z16JS_ReportWarningP9JSContextPKcz
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-411
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z17JS_DefinePropertyP9JSContextN2JS6HandleIP8JSObjectEEPKcijPFbS0_jPNS1_5ValueEESB_
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-469
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z18JS_GetPropertyByIdP9JSContextN2JS6HandleIP8JSObjectEENS2_I4jsidEENS1_13MutableHandleINS1_5ValueEEE
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-496
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z18PR_GetOpenFileInfoP10PRFileDescP10PRFileInfo
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-672
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z22GetNonexistentPropertyP9JSContextPN2js12NativeObjectE4jsidRN2JS5ValueE12IsNameLookupNS1_17FakeMutableHandleIS6_EE
1 change: 1 addition & 0 deletions in/spidermonkey-symbol-90
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Z10DoCallbackIP8JSScriptET_PN2JS14CallbackTracerEPS2_PKc
3 changes: 2 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ impl fmt::Display for Error {
Error::UnexpectedEnd => write!(f, "mangled symbol ends abruptly"),
Error::UnexpectedText => write!(f, "mangled symbol is not well-formed"),
Error::BadBackReference => {
write!(f, "back reference that is out-of-bounds of the substitution table")
write!(f,
"back reference that is out-of-bounds of the substitution table")
}
}
}
Expand Down
18 changes: 17 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,29 @@ impl<T> Symbol<T>
/// ```
/// use cpp_demangle::Symbol;
///
/// // First, something easy :)
///
/// let mangled = b"_ZN5space3fooEibc";
///
/// let sym = Symbol::new(mangled)
/// let sym = Symbol::new(&mangled[..])
/// .expect("Could not parse mangled symbol!");
///
/// let demangled = format!("{}", sym);
/// assert_eq!(demangled, "int space::foo(bool, char)");
///
/// // Now let's try something a little more complicated!
///
/// let mangled =
/// b"__Z28JS_GetPropertyDescriptorByIdP9JSContextN2JS6HandleIP8JSObjectEENS2_I4jsidEENS1_13MutableHandleINS1_18PropertyDescriptorEEE";
///
/// let sym = Symbol::new(&mangled[..])
/// .expect("Could not parse mangled symbol!");
///
/// let demangled = format!("{}", sym);
/// assert_eq!(
/// demangled,
/// "JSContext* JS_GetPropertyDescriptorById(JS::Handle<JSObject*>, JS::Handle<jsid>, JS::MutableHandle<JS::PropertyDescriptor>)"
/// );
/// ```
pub fn new(raw: T) -> Result<Symbol<T>> {
let mut substitutions = subs::SubstitutionTable::new();
Expand Down

0 comments on commit 64afc30

Please sign in to comment.