Debian Bug report logs - #383734
libavformat0d: seeks to wrong position when initial position is past first DML index

version graph

Package: libavformat0d; Maintainer for libavformat0d is (unknown);

Reported by: Ben Hutchings <ben@decadent.org.uk>

Date: Sat, 19 Aug 2006 02:03:02 UTC

Severity: normal

Tags: patch

Found in version 0.cvs20060329-3bpo1

Fixed in version 0.cvs20060823-5

Done: Reinhard Tartler <siretart@tauware.de>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Sam Hocevar (Debian packages) <sam+deb@zoy.org>:
Bug#383734; Package libavformat0d. Full text and rfc822 format available.

Acknowledgement sent to Ben Hutchings <ben@decadent.org.uk>:
New Bug report received and forwarded. Copy sent to Sam Hocevar (Debian packages) <sam+deb@zoy.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Ben Hutchings <ben@decadent.org.uk>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: libavformat0d: seeks to wrong position when initial position is past first DML index
Date: Sat, 19 Aug 2006 02:47:56 +0100
Package: libavformat0d
Version: 0.cvs20060329-3bpo1
Severity: normal
Tags: patch

I have been attempting to convert a section near the end of a large
AVI file (3.6 GB) into Ogg Theora using ffmpeg2theora.  The AVI file
has a DML index with index chunks at 1 GB intervals.  The RIFF header
apparently indicates that the file length is just over 1 GB.  What I
find is that conversion starts from around the 1 GB mark and not the
time I specified.

I tried extracting the same section with ffmpeg and found the same
problem.

I eventually enabled some debug output in avidec.c in libavformat and
used that together with strace to narrow down the problem.
avi_read_seek() seeks to the correct position but then
avi_read_packet(), having detected that the position is beyond the
declared file length, seeks again.  I cannot see what the purpose of
this seek is, and removing it fixes the problem for me:

--- ffmpeg-0.cvs20060329.orig/libavformat/avidec.c
+++ ffmpeg-0.cvs20060329/libavformat/avidec.c
@@ -594,7 +594,6 @@
 
         if (i >= avi->movi_end) {
             if (avi->is_odml) {
-                url_fskip(pb, avi->riff_end - i);
                 avi->riff_end = avi->movi_end = url_fsize(pb);
             } else
                 break;
-- END --

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (100, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.16-2-k7
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages libavformat0d depends on:
ii  libavcodec0d         0.cvs20060329-3bpo1 ffmpeg codec library
ii  libc6                2.3.2.ds1-22sarge3  GNU C Library: Shared libraries an
ii  libdc1394-11         1.0.0-4             high level programming interface f
ii  libgsm1              1.0.10-13           Shared libraries for GSM speech co
ii  libogg0              1.1.2-1             Ogg Bitstream Library
ii  libraw1394-5         0.10.1-1.1          library for direct access to IEEE 
ii  libtheora0-mmx [libt 0.0.0alpha5-2~sarge Ogg Theora video compression codec
ii  libvorbis0a          1.1.0-1             The Vorbis General Audio Compressi
ii  libvorbisenc2        1.1.0-1             The Vorbis General Audio Compressi
ii  zlib1g               1:1.2.2-4.sarge.2   compression library - runtime

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, Sam Hocevar (Debian packages) <sam+deb@zoy.org>:
Bug#383734; Package libavformat0d. Full text and rfc822 format available.

Acknowledgement sent to Ben Hutchings <ben@decadent.org.uk>:
Extra info received and forwarded to list. Copy sent to Sam Hocevar (Debian packages) <sam+deb@zoy.org>. Full text and rfc822 format available.

Message #10 received at 383734@bugs.debian.org (full text, mbox):

From: Ben Hutchings <ben@decadent.org.uk>
To: 383734@bugs.debian.org
Subject: Re: Bug#383734: libavformat0d: seeks to wrong position when initial position is past first DML index
Date: Sat, 19 Aug 2006 23:59:15 +0100
[Message part 1 (text/plain, inline)]
I wrote:
> I eventually enabled some debug output in avidec.c in libavformat and
> used that together with strace to narrow down the problem.
> avi_read_seek() seeks to the correct position but then
> avi_read_packet(), having detected that the position is beyond the
> declared file length, seeks again.  I cannot see what the purpose of
> this seek is, and removing it fixes the problem for me:
> 
> --- ffmpeg-0.cvs20060329.orig/libavformat/avidec.c
> +++ ffmpeg-0.cvs20060329/libavformat/avidec.c
> @@ -594,7 +594,6 @@
>  
>          if (i >= avi->movi_end) {
>              if (avi->is_odml) {
> -                url_fskip(pb, avi->riff_end - i);
>                  avi->riff_end = avi->movi_end = url_fsize(pb);
>              } else
>                  break;
> -- END --

After some further experimentation with the above change, I believe the
seek is necessary when reading past the first DML index (rather than
starting beyond it).  This change seems to result in correct behaviour
in both cases:

--- ffmpeg-0.cvs20060329.orig/libavformat/avidec.c
+++ ffmpeg-0.cvs20060329/libavformat/avidec.c
@@ -594,7 +594,8 @@
 
         if (i >= avi->movi_end) {
             if (avi->is_odml) {
-                url_fskip(pb, avi->riff_end - i);
+                if (i < avi->riff_end)
+                    url_fskip(pb, avi->riff_end - i);
                 avi->riff_end = avi->movi_end = url_fsize(pb);
             } else
                 break;
-- END --

Ben.

-- 
Ben Hutchings -- ben@decadentplace.org.uk shortened to ben@decadent.org.uk
If you've signed my GPG key, please send a signature on and to the new uid.
Time is nature's way of making sure that everything doesn't happen at once.
[signature.asc (application/pgp-signature, inline)]

Reply sent to Reinhard Tartler <siretart@tauware.de>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Ben Hutchings <ben@decadent.org.uk>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #15 received at 383734-done@bugs.debian.org (full text, mbox):

From: Reinhard Tartler <siretart@tauware.de>
To: 383734-done@bugs.debian.org
Subject: closed in earlier upload
Date: Sat, 23 Jun 2007 15:27:54 +0100
Version: 0.cvs20060823-5

for some  reason, this bug hasn't been closed via changelog. I'm closing
it manually for now. Here is the relevant changelog entry:

ffmpeg (0.cvs20060823-5) testing-proposed-updates; urgency=high

  [ Loïc Minier ]
  * Add myself to Uploaders.
  * Exclude firewire libs from ffmpeg-config under kFreeBSD; based on a patch
    by Petr Salinger; closes: #399701.
  * Fix handling of debug in DEB_BUILD_OPTIONS; thanks Andreas Henriksson;
    closes: #406474.
  * SECURITY: New patch, 050_h264-misc-security-fixes, to properly check the
    sps and pps ids before use and to check more bitstram values and fix
    potential security holes; from upstream SVN r7585, r7586, and r7591.
  * SECURITY: New patch, 051_asf-misc-security-fixes, to properly check
    packet sizes, chunk sizes, and fragment positions; from upstream SVN r7640
    and r7650.

  [ Sam Hocevar ]
  * debian/copyright:
    + Fix typo and clarify licensing terms (Closes: #398235).
  * debian/README.Debian:
    + Removed mention of ffmpeg-config now that we ship .pc files.
  * debian/patches/020_mmx_optims.diff:
    + New patch, fix FTBFS with DEB_BUILD_OPTIONS=debug.
  * debian/patches/040_early_altivec_detection.diff:
    + New patch, detect AltiVec earlier on and only once so that we don't
      risk using signal handlers in a multithreaded environment or when
      the caller already installed a SIGILL handler.
  * debian/patches/040_only_use_maltivec_when_needed.diff:
    + New patch, only use -maltivec with files that use AltiVec intrinsics,
      and make sure no codepath leads to these files on a non-AltiVec
      machine (Closes: #405926).
  * debian/patches/060_fix_avi_skip.diff:
    + New patch, courtesy of Ben Hutchings: do not attempt to skip the ODML
      if the current seek offset is already beyond it (Closes: #383734).

 -- Sam Hocevar (Debian packages) <sam+deb@zoy.org>  Mon, 29 Jan 2007 16:58:44 +0100


-- 
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4



Bug marked as fixed in version 0.cvs20060823-5. Request was from Sam Hocevar <sam@zoy.org> to control@bugs.debian.org. (Tue, 26 Jun 2007 17:02:09 GMT) Full text and rfc822 format available.

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Wed, 25 Jul 2007 07:29:10 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Apr 16 05:29:34 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.