Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#4326 closed defect (fixed)

ffplay does not show dvb subtitles

Reported by: banastasov Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: dvbsub regression
Cc: Michael Niedermayer Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:ffplay does not show dvb subtitles

There is a problem introduced after adding error codes in
libavcodec/dvbsubdec.c

The first commit introducing the error codes is:

commit 1bf747ae84fc7b1339ab4459d9d9ba2e9c341616
Author: Michael Niedermayer <michaelni@gmx.at>
Date: Sat Jan 10 19:24:27 2015 +0100

avcodec/dvbsubdec: Return proper error codes from more functions


Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

It adds this:

@@ -1478,7 +1481,7 @@ static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
     }
 
     if (buf_size < 13)
-        return;
+        return 0;
 
     if (info_byte & 1<<3) { // display_window_flag
         display_def->x = bytestream_get_be16(&buf);

which later is changed from another commit:
commit 607ad990d31e6be52980970e5ce8cd25ab3de812
Author: Vittorio Giovara <vittorio.giovara@gmail.com>
Date: Wed Dec 17 16:02:09 2014 +0100

dvbsubdec: check memory allocations and propagate errors

to:

@@ -1279,7 +1300,7 @@ static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
     display_def->height  = bytestream_get_be16(&buf) + 1;
 
     if (buf_size < 13)
-        return;
+        return AVERROR_INVALIDDATA;
 
     if (info_byte & 1<<3) { // display_window_flag
         display_def->x = bytestream_get_be16(&buf);

This does not work, because now the check is not correct.
It should check buf_size only if the next 'if' is fulfilled:

if (info_byte & 1<<3)

Only then the additional 8 bytes are needed.

I have added debug to see if the 'if' is fulfilled, but it is not, at least for my files, and the buf_size is always 5 bytes, which triggers the ret < 0 error.
Because of this change dvb subtitles are not displayed.

The size check should be in the 'if', something like:

    if (info_byte & 1<<3) { // display_window_flag
        if (buf_size < 13)
            return AVERROR_INVALIDDATA;
        display_def->x = bytestream_get_be16(&buf);
        display_def->width  = bytestream_get_be16(&buf) - display_def->x + 1;
        display_def->y = bytestream_get_be16(&buf);
        display_def->height = bytestream_get_be16(&buf) - display_def->y + 1;
    }

Change History (5)

comment:1 by Michael Niedermayer, 10 years ago

can you upload one of your files / provide a testcase ?

comment:2 by Michael Niedermayer, 10 years ago

Cc: Michael Niedermayer added
Resolution: fixed
Status: newclosed

Suggested change made in debf4d6e67dfb29f3d71683add429c588828f8e8
iam still interrested in a testcase though if you can share one of your samples

comment:3 by Carl Eugen Hoyos, 10 years ago

Component: undeterminedavcodec
Keywords: dvbsub added
Version: unspecifiedgit-master

comment:4 by banastasov, 9 years ago

Sorry about the delay.

I have uploaded two files:
dvbsub_ticket4326_working.ts - working without this patch
dvbsub_ticket4326_not_working.ts - NOT working without this patch

so you can test with or without the patch.

comment:5 by Carl Eugen Hoyos, 9 years ago

Keywords: regression added
Priority: normalimportant
Reproduced by developer: set
Note: See TracTickets for help on using tickets.