Opened 5 years ago

Closed 5 years ago

Last modified 5 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 Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no


Summary of the bug:ffplay does not show dvb subtitles

There is a problem introduced after adding error codes in

The first commit introducing the error codes is:

commit 1bf747ae84fc7b1339ab4459d9d9ba2e9c341616
Author: Michael Niedermayer <>
Date: Sat Jan 10 19:24:27 2015 +0100

avcodec/dvbsubdec: Return proper error codes from more functions

Signed-off-by: Michael Niedermayer <>

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 <>
Date: Wed Dec 17 16:02:09 2014 +0100

dvbsubdec: check memory allocations and propagate errors


@@ -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 Changed 5 years ago by michael

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

comment:2 Changed 5 years ago by michael

  • Cc michael added
  • Resolution set to fixed
  • Status changed from new to closed

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

comment:3 Changed 5 years ago by cehoyos

  • Component changed from undetermined to avcodec
  • Keywords dvbsub added
  • Version changed from unspecified to git-master

comment:4 Changed 5 years ago by banastasov

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 Changed 5 years ago by cehoyos

  • Keywords regression added
  • Priority changed from normal to important
  • Reproduced by developer set
Note: See TracTickets for help on using tickets.