GNOME Bugzilla – Bug 333488
Allow for palette < 256 colours in AVI files
Last modified: 2006-03-14 15:13:39 UTC
Some AVI files have a palette of less than 256 colours. Currently, GStreamer ignores the palette if it has less than 256 colours, but it is legal to have a smaller palette
Created attachment 60692 [details] [review] Patch for allowing palettes with less tahn 256 colours in AVI files With this patch, the number of colours is checked, and the palette is added even if it has less than 256 colours
Committed with minor modifications, thanks! 2006-03-08 Tim-Philipp Müller <tim at centricular dot net> * gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps): Allow palettes with less than 256 colours in AVI files (#333488, patch by: Fabrizio Gennari).
Created attachment 61000 [details] [review] Small modification May I suggest a small improvement? In the current code, GST_BUFFER_SIZE(palette) is never checked, in particular it is never checked if it is > GST_BUFFER_SIZE(copy). Well, I never found a practical case, but theoretically it could happen. This patch should prevent overflows.
Very right, I messed that up. Sorry. Should probably go into the pending release, as it is security relevant to some extent. Thomas, the addition is only a + if (GST_BUFFER_SIZE (palette) >= num_colors * 4) { + } can this go in?
Committed, thanks for catching this. 2006-03-10 Tim-Philipp Müller <tim at centricular dot net> * gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps): Make sure we don't read beyond the palette buffer in case of broken or manipulated files (#333488, patch by: Fabrizio Gennari)
Created attachment 61209 [details] [review] Smaller modification A one-liner to ensure GST_BUFFER_DATA (copy) >= GST_BUFFER_DATA (palette) always (not that I ever found such a case, but you never know...). This is the last time I'm picky, promise!
Nothing better than a good dose of paranoia and due caution ;) Committed: 2006-03-14 Tim-Philipp Müller <tim at centricular dot net> Patch by: Fabrizio Gennari <fabrizio dot ge at tiscali dot it> * gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps): Make sure the buffer we copy into is really always big enough, this time for real (#333488).