[Cin] tried to make giflist, got segfault

Andrew Randrianasulu randrianasulu at gmail.com
Sun Dec 12 00:45:57 CET 2021

this patch prevent gif segfault problem (but all images become  the same
for given list!) , but not sure about other, similar crashes you observed?

On Sunday, December 12, 2021, Phyllis Smith <phylsmith2017 at gmail.com> wrote:

>> Probably should log a BT for this, but the good news (from my
>>> perspective!) is that it has always crashed when the W and H are not the
>>> same in all of the listed GIFs.  But, for example, if you reduce the
>>> giflist to include only info.gif and note.gif which both have dimensions of
>>> 32x32, it does not crash.  Same problem occurs with jpegs, which is the
>>> only other one I tested.
>> yeah, i tend to do unexpected from time to time. Still, some safeguard
>> against this might be nice to have (and for now - note/warning in
>> documentation? yes, this is not that advanced users will do - but new users
>> tend to experiment!  or so I think....)
>> I'll look into this problem too...
> I agree that it needs a safeguard.  Let me know if you do not find a
> solution because a freelancer wants to work on something and I thought he
> might be able to actually do this.  Most of the problems are way too
> difficult for someone not familiar with Cinelerra to even attempt to work
> on.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20211212/f952a7c3/attachment.htm>
-------------- next part --------------
diff --git a/cinelerra-5.1/cinelerra/filegif.C b/cinelerra-5.1/cinelerra/filegif.C
index bb26762b..baaa46af 100644
--- a/cinelerra-5.1/cinelerra/filegif.C
+++ b/cinelerra-5.1/cinelerra/filegif.C
@@ -335,6 +335,10 @@ int FileGIF::read_next_image(VFrame *output)
 	if( ret > 0 && output ) {
 		int screen_width = gif_file->SWidth;
 		int screen_height = gif_file->SHeight;
+		int output_w = output->get_w();
+		int output_h = output->get_h();
+		if (screen_width != output_w || screen_height != output_h)
+			return -1;
 		for( int i=0; i<screen_height; ++i ) {
 			GifRowType row = buffer[i];
 			unsigned char *out_ptr = output->get_rows()[i];

More information about the Cin mailing list