Signed integer overflow in Sfixnum after LZ4 decompression
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Start in c/new-io.c at the decompression path that calls LZ4_decompress_safe and returns Sfixnum(r); read the surrounding bytevector-uncompress handling to see how the byte count is scaled by the fixnum tag. Check whether other size conversions in the same file have the same 32-bit-int overflow shape, then build and run the bytevector-uncompress repro on a 64-bit build with compress-format 'lz4. Done means a decompression of 2^28 bytes returns the correct length without signed overflow.
Written by the indexing model from the issue text.
Description
In c/new-io.c, the return value of LZ4_decompress_safe is converted using:
return Sfixnum(r);
On ta6nt, int is 32 bits and Sfixnum(r) computes r * 8 before casting. A successful LZ4 decompression returning at least 268,435,456 bytes therefore triggers signed overflow. Casting r to iptr before the multiplication fixes this on 64-bit builds.
eg.
(import (chezscheme))
(parameterize ([compress-format 'lz4] [compress-level 'low])
(write (bytevector-length (bytevector-uncompress (bytevector-compress (make-bytevector (expt 2 28) 0))))))
- Dominant language
- Scheme
- Stars
- 7.4k
- Forks
- 1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 19
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cisco/ChezScheme
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
cisco/ChezScheme#1111 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 12/100
cisco/ChezScheme#1101 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
cisco/ChezScheme#1078 · 1 comment ·
Maintainers usually reply within 1 day
-
RFC: solution to clangd not finding "scheme.h"Possibly taken @reginaldalfret claimed this 20 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
cisco/ChezScheme#1073 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
cisco/ChezScheme#1063 ·
Maintainers usually reply within 1 day
All issues in cisco/ChezScheme
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 82/100
supercollider/supercollider#7872 · 1 comment ·
Maintainers usually reply within 1 day
-
bug I/O low priority semantics
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
pocket-stack/pocketjs#729 ·
-
[BUG]: C# programs with top-level statements fail to compilePossibly taken @AsyncNigam claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
compiler-explorer/compiler-explorer#9625 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
baseballyama/rsvelte#5086 ·
Maintainers usually reply within 1 day