[FFmpeg-trac] #4326(undetermined:new): ffplay does not show dvb subtitles

FFmpeg trac at avcodec.org
Tue Feb 24 12:32:37 CET 2015


#4326: ffplay does not show dvb subtitles
-------------------------------------+-------------------------------------
             Reporter:  banastasov   |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 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 at 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 at 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 at 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;
     }

 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4326>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list