After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 658973 - mpegvideoparse: avoid reading past a buffer
mpegvideoparse: avoid reading past a buffer
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other All
: Normal normal
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-09-13 17:48 UTC by Vincent Penquerc'h
Modified: 2011-10-29 15:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mpegvideoparse: avoid reading past a buffer (1.60 KB, patch)
2011-09-13 17:48 UTC, Vincent Penquerc'h
none Details | Review

Description Vincent Penquerc'h 2011-09-13 17:48:45 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.
Comment 1 Vincent Penquerc'h 2011-09-13 17:48:47 UTC
Created attachment 196426 [details] [review]
mpegvideoparse: avoid reading past a buffer
Comment 2 Thibault Saunier 2011-09-15 10:56:53 UTC
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.