#8385(avformat:new): libavformat/aviobuf: A part of conditional expression is always true: whence != 2
#8385: libavformat/aviobuf: A part of conditional expression is always true: whence != 2 ----------------------------------+-------------------------------------- Reporter: Balling | Type: defect Status: new | Priority: normal Component: avformat | Version: git-master Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ----------------------------------+-------------------------------------- If you look here https://github.com/FFmpeg/FFmpeg/blob/b741a84a15aed8afa01800dbc4b8b0e344e5d2... you will see that on line 265 we would have already returned if whence were SEEK_END (2). It is not changed in between. This change was done in commit: https://github.com/FFmpeg/FFmpeg/commit/7a6fe01f99cb95797ba59134f44b6666b1a5... whence != SEEK_END is always true, so short circuiting and force will not be checked. Also see #8156 https://trac.ffmpeg.org/attachment/ticket/8156/project2019.tasks Dunno how to fix it. The code is like this (): {{{ if (whence != SEEK_CUR && whence != SEEK_SET) return AVERROR(EINVAL); if (whence == SEEK_CUR) { offset1 = pos + (s->buf_ptr - s->buffer); if (offset == 0) return offset1; if (offset > INT64_MAX - offset1) return AVERROR(EINVAL); offset += offset1; } if (offset < 0) return AVERROR(EINVAL); if (s->short_seek_get) { short_seek = s->short_seek_get(s->opaque); /* fallback to default short seek */ if (short_seek <= 0) short_seek = s->short_seek_threshold; } else short_seek = s->short_seek_threshold; offset1 = offset - pos; // "offset1" is the relative offset from the beginning of s->buffer s->buf_ptr_max = FFMAX(s->buf_ptr_max, s->buf_ptr); if ((!s->direct || !s->seek) && offset1 >= 0 && offset1 <= (s->write_flag ? s->buf_ptr_max - s->buffer : buffer_size)) { /* can do the seek inside the buffer */ s->buf_ptr = s->buffer + offset1; } else if ((!(s->seekable & AVIO_SEEKABLE_NORMAL) || offset1 <= buffer_size + short_seek) && !s->write_flag && offset1 >= 0 && (!s->direct || !s->seek) && (whence != SEEK_END || force)) { }}} -- Ticket URL: <https://trac.ffmpeg.org/ticket/8385> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#8385: libavformat/aviobuf: A part of conditional expression is always true: whence != 2 ------------------------------------+------------------------------------ Reporter: Balling | Owner: Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Changes (by Balling): * status: new => open Comment: Maybe you will fix this?)) -- Ticket URL: <https://trac.ffmpeg.org/ticket/8385#comment:1> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#8385: libavformat/aviobuf: A part of conditional expression is always true: whence != 2 ------------------------------------+------------------------------------ Reporter: Balling | Owner: (none) Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by Balling): My patch is here. https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210604062818.2099-1-val.... THIS IS a fix for core API, and frankly speacking should be fixed, in fact it says there force does not work. -- Ticket URL: <https://trac.ffmpeg.org/ticket/8385#comment:2> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#8385: libavformat/aviobuf: A part of conditional expression is always true: whence != 2 ------------------------------------+------------------------------------ Reporter: Balling | Owner: (none) Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by Balling): For IRC people... This typos patch 41ed7ab45fc693f7d7fc35664c0233f4c32d69bb changed the documentation of AVSEEK_SIZE and AVSEEK_FORCE, it looks incorrect, other place documents that "optional AVSEEK_FORCE bit" is a thing, so I think "Oring this flag into "whence"" is more correct. It also says that **Valid values are SEEK_SET, SEEK_CUR, SEEK_END (as in C library), AVSEEK_SIZE** so those are just passed as is, it is only AVSEEK_FORCE that is just a bit and not an actual value. James? Anyone? -- Ticket URL: <https://trac.ffmpeg.org/ticket/8385#comment:3> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#8385: libavformat/aviobuf: A part of conditional expression is always true: whence != 2 ------------------------------------+------------------------------------ Reporter: Balling | Owner: (none) Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Changes (by MasterQuestionable): * cc: MasterQuestionable (added) Comment: ͏ "OR this flag", for semantic clarity. ͏ . ͏ Derivatives of special words have to take special attention. ͏ Alike: https://trac.ffmpeg.org/ticket/11055#comment:40 ͏ Also, how much relevance with this? ͏ https://trac.ffmpeg.org/ticket/11060 -- Ticket URL: <https://trac.ffmpeg.org/ticket/8385#comment:4> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#8385: libavformat/aviobuf: A part of conditional expression is always true: whence != 2 ------------------------------------+------------------------------------ Reporter: Balling | Owner: (none) Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by Balling): See for yourself, this commit is wrong https://github.com/FFmpeg/FFmpeg/commit/7a6fe01f99cb95797ba59134f44b6666b1a5... "Seeking forward in non-seekable media by discarding data, regardless of how far to seek. Won't SEEK_END unless forced though." -- Ticket URL: <https://trac.ffmpeg.org/ticket/8385#comment:5> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#8385: libavformat/aviobuf: A part of conditional expression is always true: whence != 2 ------------------------------------+------------------------------------ Reporter: Balling | Owner: (none) Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by MasterQuestionable): ͏ I did trace the aforementioned links. ͏ But too many things are too vaguely defined: meaning not easily fathomable. ͏ So I would like some more clear guidance from those who familiar with it. ͏ If necessary, I may rewrite the whole thing. ͏ (given clear specifications) -- Ticket URL: <https://trac.ffmpeg.org/ticket/8385#comment:6> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#8385: libavformat/aviobuf: A part of conditional expression is always true: whence != 2 ------------------------------------+------------------------------------ Reporter: Balling | Owner: (none) Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by Balling): Maybe the actual patch is that this line https://github.com/FFmpeg/FFmpeg/blob/b741a84a15aed8afa01800dbc4b8b0e344e5d2... should add || whence != SEEK_END That was laster whence can be SEEK_END and will in fact work only if whence contained AVSEEK_FORCE flag. -- Ticket URL: <https://trac.ffmpeg.org/ticket/8385#comment:7> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#8385: libavformat/aviobuf: A part of conditional expression is always true: whence != 2 ------------------------------------+------------------------------------ Reporter: Balling | Owner: (none) Type: defect | Status: open Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by Balling): https://www.mail-archive.com/search?l=ffmpeg- devel@ffmpeg.org&q=subject:%22%5C%5BFFmpeg%5C- devel%5C%5D+%5C%5BPATCH+2%5C%2F2%5C%5D+avformat%5C%2Fmp3enc%5C%3A+Avoid+SEEK_END+as+it+is%09unsupported%22&o=newest&f=1 Oh, wow. It is well understood that SEEK_END is not supported. Seriously?? -- Ticket URL: <https://trac.ffmpeg.org/ticket/8385#comment:8> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg