Skip to content

Conversation

@tonkosi
Copy link
Contributor

@tonkosi tonkosi commented Jun 14, 2021

Improved checks:

  • Don't take addresses of reference / virtually inherited fields in expressions such as &(invalid_struct_ptr)->virt_or_ref_field. In general, this kind of expression is OK because compiler can determine offset of the field statically and add it to the pointer. But reference fields and virtually inherited fields require a read from memory to determine the offset.
  • Don't cast between different pointer types if read from memory is expected, e.g. *(int*)float_ptr, or ((StructB*)struct_a_ptr)->field.

@github-actions
Copy link

Benchmark comparison for fb84fb26 (base) vs df8b4894 (PR)

Benchmark                             Time             CPU      Time Old      Time New       CPU Old       CPU New
------------------------------------------------------------------------------------------------------------------
BM/AddTwoNumbers                   +0.0133         +0.0127        136617        138431        136607        138347
BM/ArrayDereference                -0.0009         -0.0009        142333        142205        142323        142195
BM/ArraySubscript                  +0.0054         +0.0058        186453        187459        186365        187444
BM/TypeCasting                     +0.0014         +0.0014        486141        486814        486096        486756
BM/ParseInteger                    +0.0050         +0.0050        200688        201683        200667        201670

@tonkosi tonkosi requested a review from werat June 14, 2021 14:38
@werat werat merged commit d96cefe into master Jun 16, 2021
@werat werat deleted the tonkosi/fuzzer-virt-ref-fields branch June 16, 2021 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants