[FFmpeg-trac] #9185(avformat:new): ffmpeg flac decoder incorrectly finds junk frame

FFmpeg trac at avcodec.org
Tue May 25 19:23:07 EEST 2021


#9185: ffmpeg flac decoder incorrectly finds junk frame
-------------------------------------+-------------------------------------
             Reporter:  Mattias      |                    Owner:  (none)
  Wadman                             |
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:  avformat
              Version:  git-master   |               Resolution:
             Keywords:  flac         |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Comment (by Mattias Wadman):

 Looked a bit into this again. With this patch that only looks for frames
 with fixed blocking strategy flac_junk_frame_issue2.flac seems to decode
 correctly and produce samples that matches those produced by the FLAC
 reference decoder. So it seems as it ends up finding a false frame header
 somehow.

 {{{
 diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
 index d3d9c889a1..c441543147 100644
 --- a/libavcodec/flac_parser.c
 +++ b/libavcodec/flac_parser.c
 @@ -218,7 +218,7 @@ static int find_headers_search(FLACParseContext *fpc,
 uint8_t *buf,
          x = AV_RN32(buf + i);
          if (((x & ~(x + 0x01010101)) & 0x80808080)) {
              for (j = 0; j < 4; j++) {
 -                if ((AV_RB16(buf + i + j) & 0xFFFE) == 0xFFF8) {
 +                if ((AV_RB16(buf + i + j) & 0xFFFF) == 0xFFF8) {
                      int ret = find_headers_search_validate(fpc,
 search_start + i + j);
                      size = FFMAX(size, ret);
                  }
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9185#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list