GNOME Bugzilla – Bug 658973
mpegvideoparse: avoid reading past a buffer
Last modified: 2011-10-29 15:07:27 UTC
When no start codes are found, the offset reached by the scan is remembered, so scanning will next start there. However, when not specifying an aount of bytes to skip next time, baseparse skips a default of 1 byte. This can cause baseparse to sent the same data except the first byte, which then causes the offset to point one past the end of the buffer. So, set the number of bytes to skip to 0. Note that I'm not sure why most bytes aren't skipped and the offset set at a lowish value. It could be because a long frame might be found with more data, but it seems like this could be quite performance heavy, so someone who knows the format might want to check if skipping would not be better, especially as not skipping anything may end up causing an infinite loop. It works here though, so it gets posted.
Created attachment 196426 [details] [review] mpegvideoparse: avoid reading past a buffer
Fixed by: commit df551c0af4d2893e157afcc8af9c274d5546596b Author: Thibault Saunier <thibault.saunier@collabora.com> Date: Tue Sep 13 20:40:35 2011 -0300 mpegvideoparse: Handle properly frame detection Handle the case where we have buffers containing no startcode in the middle of a frame properly.