Skip to content
Open
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
8 changes: 6 additions & 2 deletions src/gif.imageio/gifinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ GIFInput::read_subimage_data()

if (m_subimage == 0 || m_previous_disposal_method == DISPOSE_BACKGROUND) {
// make whole canvas transparent
std::fill(m_canvas.begin(), m_canvas.end(), 0x00);
m_canvas.clear();
m_canvas.resize(m_spec.image_pixels() * size_t(4), 0x00);
}

// decode scanline index if image is interlaced
Expand Down Expand Up @@ -412,7 +413,6 @@ GIFInput::seek_subimage(int subimage, int miplevel)
return false;
}
m_subimage = -1;
m_canvas.resize(m_gif_file->SWidth * m_gif_file->SHeight * 4);
}

// skip subimages preceding the requested one
Expand All @@ -436,6 +436,10 @@ GIFInput::seek_subimage(int subimage, int miplevel)
m_spec.full_width = m_spec.width;
m_spec.full_depth = m_spec.depth;

if (!check_open(m_spec, { 0, 32768, 0, 32768, 0, 1, 0, 4 })) {
return false;
}

m_subimage = subimage;

// draw subimage on canvas
Expand Down
3 changes: 3 additions & 0 deletions testsuite/gif/ref/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ tahoe-tiny.gif : 128 x 96, 4 channel, uint8 gif
oiio:ColorSpace: "srgb_rec709_scene"
oiio:LoopCount: 0
oiio:Movie: 1
oiiotool ERROR: read : "src/crash_4163.gif": Wrong record type detected
Full command line was:
> oiiotool -nostderr -oiioattrib try_all_readers 0 src/crash_4163.gif -o test.exr
5 changes: 5 additions & 0 deletions testsuite/gif/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@
# Test write / conversion to GIF
command += oiiotool (OIIO_TESTSUITE_ROOT+"/common/tahoe-tiny.tif -o tahoe-tiny.gif")
command += info_command ("tahoe-tiny.gif")

# Regression tests
command += oiiotool ("-nostderr -oiioattrib try_all_readers 0 src/crash_4163.gif -o test.exr", failureok = True)

outputs = [ "tahoe-tiny.gif", "out.txt" ]
Binary file added testsuite/gif/src/crash_4163.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading