GNOME Bugzilla – Bug 655347
theoradec: segfault on 0-byte ogg_packet in _chain_reverse
Last modified: 2011-08-03 09:06:41 UTC
An ogg_packet can be 0 bytes and apparently this is used in Theora. The keyframe check in theora_dec_chain_reverse doesn't handle this and segfaults. The input is svt2-44100Hz.ogv from http://bugzilla-attachments.gnome.org/attachment.cgi?id=192617 with a test case like this: <video src="svt2-44100Hz.ogv" controls></video> <script> var v = document.querySelector('video'); v.onsuspend = function() { v.currentTime = v.duration; v.playbackRate = -1; v.play(); }; v.preload = "auto"; </script> In other words, seek to the end and try playing backwards. There will be a zero-byte buffer on the gather queue. It doesn't play very well even with this fix, but at least it doesn't crash.
Created attachment 192669 [details] [review] quickfix
If one inspects oggdemux, one will find that the first empty packet is actually a Skeleton packet, which can be empty according to http://wiki.xiph.org/Ogg_Skeleton#Ogg_Skeleton_version_4.0_Format_Specification I assume that later there are empty Theora packets, which is also OK according to #xiph on FreeNode.
Looks good.
commit 7d22d91fca6b9f24ca205eef98031f1ed6a44d33 Author: Philip Jägenstedt <philipj@opera.com> Date: Tue Jul 26 16:10:17 2011 +0200 theoradec: segfault on 0-byte ogg_packet in _chain_reverse