Skip to content
Snippets Groups Projects
Commit 186c4c79 authored by hansmi's avatar hansmi
Browse files

Avoid memory leak from ill-formatted serialization data


At commit 060d7914 the following `fuzzing/usbredirparserfuzz` input triggers
a memory leak:

```
$ base64 -d <<'EOF' | gunzip -c > testcase
H4sIAFDwJ2ECA2NgZIADBQWF/zD2HQgfAv4DgcJ/BTzgP0iRAlwRivL/ePX9
R1VAyBaSjcShB8nPTBA9/xn+g5UAANvH+dkSAQAA
```

The data type header segment is empty while there's (supposed) payload data in
there. The internal buffers must be filled in the order of header, type header
and then data, an invariant important for `usbredirparser_do_read` and violated
by this input.

With this change the input data is read the same way, but if the invariant would
be violated the data read is just ignored.

The parser check at the beginning of `usbredirparser_unserialize` is also
improved and `write_buf_count` is no longer set explicitly.

Signed-off-by: default avatarMichael Hanselmann <public@hansmi.ch>
parent c3c67aba
No related branches found
No related tags found
1 merge request!48Avoid memory leak from ill-formatted serialization data
Checking pipeline status
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment