diff options
author | vanhauser-thc <vh@thc.org> | 2023-06-07 10:57:52 +0200 |
---|---|---|
committer | vanhauser-thc <vh@thc.org> | 2023-06-07 10:57:52 +0200 |
commit | f6471dd256ac04f51c2107533055a2d9c9a18fc7 (patch) | |
tree | 83d15ff33941c11f7b1d751c2361b8863f0e25fe | |
parent | f0ccca123ad8f9813ad141ebd243e8c7b96824a1 (diff) | |
download | afl++-f6471dd256ac04f51c2107533055a2d9c9a18fc7.tar.gz |
fix gcc cmplog crash
-rw-r--r-- | instrumentation/afl-gcc-cmptrs-pass.so.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/instrumentation/afl-gcc-cmptrs-pass.so.cc b/instrumentation/afl-gcc-cmptrs-pass.so.cc index dbb408b0..c56263dd 100644 --- a/instrumentation/afl-gcc-cmptrs-pass.so.cc +++ b/instrumentation/afl-gcc-cmptrs-pass.so.cc @@ -157,6 +157,9 @@ struct afl_cmptrs_pass : afl_base_pass { /* We expect it to be a record type. */ if (TREE_CODE(t) != RECORD_TYPE) return false; + /* The type has an identifier. */ + if (!TYPE_IDENTIFIER(t)) return false; + /* The type of the template is basic_string. */ if (strcmp(IDENTIFIER_POINTER(TYPE_IDENTIFIER(t)), "basic_string") != 0) return false; @@ -201,7 +204,7 @@ struct afl_cmptrs_pass : afl_base_pass { /* Now go back to the first data member. Its type should be a record type named _Alloc_hider. */ c = TREE_TYPE(c); - if (!c || TREE_CODE(c) != RECORD_TYPE || + if (!c || TREE_CODE(c) != RECORD_TYPE || !TYPE_IDENTIFIER(t) || strcmp(IDENTIFIER_POINTER(TYPE_IDENTIFIER(c)), "_Alloc_hider") != 0) return false; |