diff options
| author | 2026-04-13 16:07:06 -0300 | |
|---|---|---|
| committer | 2026-04-22 09:55:26 -0500 | |
| commit | 4c221711b23745e2fb961ee517e9ed96ce76f9cb (patch) | |
| tree | 50fead7923b5f343f6b3d0fb48184c90f9fd37a7 /tools/perf/scripts/python/bin/stackcollapse-record | |
| parent | smb: client: scope end_of_dacl to CIFS_DEBUG2 use in parse_dacl (diff) | |
smb: client: compress: fix buffer overrun in lz77_compress()
@dst buffer is allocated with same size as @src, which, for good
compression cases, works fine.
However, when compression goes bad (e.g. random bytes payloads), the
compressed size can increase significantly, and even by stopping the
main loop at 7/8 of @slen, writing leftover literals could write past
the end of @dst because of LZ77 metadata.
To fix this, add lz77_compressed_alloc_size() helper to compute the
correct allocation size for @dst, accounting for metadata and worst
cast scenario (all literals).
While this is overprovisioning memory, it's not only correct, but also
allows lz77_compress() main loop to run without ever checking @dst
limits (i.e. a perf improvement).
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-record')
0 files changed, 0 insertions, 0 deletions
