[vlc-devel] [PATCH 4/4] demux: ogg: Fix creating index entries before the first existing entry
Michael Tänzer
neo at nhng.de
Sun Feb 7 16:53:44 CET 2016
On 06.02.2016 15:33, Francois Cartegnie wrote:
> Le 31/01/2016 00:29, Michael Tänzer a écrit :
>> ---
>> modules/demux/oggseek.c | 7 +++----
>> 1 file changed, 3 insertions(+), 4 deletions(-)
>
>> - oidx = idx = p_stream->idx;
>> + idx = p_stream->idx;
>
> I doubt having added that code without reason.
The reason for changing this code is that the sorted list implementation
that was custom-hacked for the ogg-index is wrong: it doesn't add
entries before the first existing entry. Don't you have standard
container functions for such tasks?
When it tries to insert a value that has an i_pagepos lower than the
first element in the list the loop instantly terminates and the control
flow goes into the changed else block. In the block the p_next of the
newly allocated index will be set to oidx == p_stream->idx but in the
next step oidx which is just a local variable will be set to the newly
allocated element, but not the list head. So we have a dangling index
element. Then the p_prev of the first element will be set to the newly
allocated element. So the end configuration will look like this:
p_stream->idx
|
V
##### --> ####### --> #####
#new# #first# #...#
##### <-- ####### <-- #####
So the new element is allocated but will never be used as an index entry
because the list head doesn't point to it. It might even lead to a
memory leak. My code fixes that issue.
> Please check tickets and test samples from description of
> d1c8352d4312dfb012022241866ade506b514f4c
I tried the samples from bugs #3417 and #9284 and they seem to work
fine. At least the seeking shows no worse behaviour than with the
version of vlc without my changes.
Cheers,
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160207/989425c8/attachment.sig>
More information about the vlc-devel
mailing list