dylint icon indicating copy to clipboard operation
dylint copied to clipboard

Extend `wrong_serialize_struct_arg` to handle `serialize_struct_variant`, etc.

Open smoelius opened this issue 2 years ago • 0 comments

wrong_serialize_struct_arg is here: https://github.com/trailofbits/dylint/tree/master/examples/general/wrong_serialize_struct_arg

Additional methods it might handle are the following:

The ones that are not serialize_tuple should be straightforward, as they also involve calls to serialize_field. The main changes should be:

  • Changing the path that is checked for: https://github.com/trailofbits/dylint/blob/d75ae91f34613a329a231797a0142066194b5f3d/examples/general/wrong_serialize_struct_arg/src/lib.rs#L125
  • Changing how the len argument is extracted: https://github.com/trailofbits/dylint/blob/d75ae91f34613a329a231797a0142066194b5f3d/examples/general/wrong_serialize_struct_arg/src/lib.rs#L126-L127
  • Adjusting the diagnostic message: https://github.com/trailofbits/dylint/blob/d75ae91f34613a329a231797a0142066194b5f3d/examples/general/wrong_serialize_struct_arg/src/lib.rs#L103-L106

Handling serialize_tuple will be slightly more involved, as it requires counting calls to serialize_element instead of serialize_field.

smoelius avatar Sep 23 '23 00:09 smoelius