Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3951: Invalid read from an empty vector during RLA load #3960

Merged
merged 2 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rla.imageio/rlainput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ RLAInput::decode_channel_group(int first_channel, short num_channels,
size_t length = lenu16;
// Read the encoded RLE record
encoded.resize(length);
if (!read(&encoded[0], length)) {
if (!length || !read(&encoded[0], length)) {
errorfmt("Read error: couldn't read RLE data span");
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions testsuite/rla/ref/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,8 @@ Full command line was:
oiiotool ERROR: read : "src/crash-1629.rla": Read error: malformed RLE record
Full command line was:
> oiiotool src/crash-1629.rla -o crash3.exr
oiiotool ERROR: read : "src/crash-3951.rla": Read error: couldn't read RLE data span
Full command line was:
> oiiotool src/crash-3951.rla -o crash4.exr
Comparing "rlacrop.rla" and "ref/rlacrop.rla"
PASS
1 change: 1 addition & 0 deletions testsuite/rla/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
command += oiiotool(OIIO_TESTSUITE_IMAGEDIR + "/rla/crash1.rla -o crash1.exr", failureok = True)
command += oiiotool(OIIO_TESTSUITE_IMAGEDIR + "/rla/crash2.rla -o crash2.exr", failureok = True)
command += oiiotool("src/crash-1629.rla -o crash3.exr", failureok = True)
command += oiiotool("src/crash-3951.rla -o crash4.exr", failureok = True)

outputs = [ "rlacrop.rla", 'out.txt' ]
Binary file added testsuite/rla/src/crash-3951.rla
Binary file not shown.
Loading