Package: libxine1-misc-plugins
Version: 1.1.16.3-1
Severity: normal

I frequently use xine to view raw DV files recorded with dvgrab.  Now,
these files tend to get large (a 30-minute recording is almost 7GB), and
for as long as I can remember, I've had the problem that, starting
around the 20-minute mark (corresponding to the limit of a 32-bit file
offset), trying to move forward or backward with the left/right arrow
keys would jump back to near the beginning of the file, exactly as
though the file offset had been truncated to 32 bits, which xine-lib is
supposed to be smart enough to avoid.  Well, I finally got frustrated
enough with it to track down and fix the problem.

The offending code is at lines 304-306 of src/demuxers/demux_rawdv.c, in
the function demux_raw_dv_seek():

  if( !start_pos && start_time ) {
    start_pos = (start_time * 90 / this->duration) * this->frame_size;
  }

Now, start_pos is of type off_t, and since we compile with
-D_FILE_OFFSET_BITS=64, off_t is a 64-bit long long int, so you'd think
we'd be fine here --- but we aren't, because start_time, this->duration
and this->frame_size are all 32-bit ints, which means that the computed
seek position gets truncated to 32 bits before it's assigned to
start_pos.  The simple solution, as implemented in the attached patch,
is to cast start_time to off_t in line 305, expanding the computation to
64 bits in time to avoid truncation.

For a one-line fix, I almost feel silly including a patch, but it's
attached for completeness.  Thanks.

                                                -sbigham

-- System Information:
Debian Release: 5.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages libxine1-misc-plugins depends on:
ii  libasound2            1.0.16-2           ALSA library
ii  libbz2-1.0            1.0.5-1            high-quality block-sorting file co
ii  libc6                 2.7-18             GNU C Library: Shared libraries
ii  libflac8              1.2.1-1.2          Free Lossless Audio Codec - runtim
ii  libfontconfig1        2.6.0-3            generic font configuration library
ii  libfreetype6          2.3.7-2+lenny1     FreeType 2 font engine, shared lib
ii  libice6               2:1.0.4-1          X11 Inter-Client Exchange library
ii  libjack0              0.116.1-4          JACK Audio Connection Kit (librari
ii  libjpeg62             6b-14              The Independent JPEG Group's JPEG 
ii  liblcms1              1.17.dfsg-1+lenny1 Color management library
ii  libmagick10           7:6.3.7.9.dfsg1-3  image manipulation library
ii  libmng1               1.0.9-1            Multiple-image Network Graphics li
ii  libmodplug0c2         1:0.8.7-1          shared libraries for mod music bas
ii  libmpcdec3            1.2.2-1            Musepack (MPC) format library
ii  libogg0               1.1.3-4            Ogg Bitstream Library
ii  libpulse0             0.9.15-2           PulseAudio client libraries
ii  libsm6                2:1.0.3-2          X11 Session Management library
ii  libsmbclient          2:3.2.5-4lenny2    shared library that allows applica
ii  libspeex1             1.2~rc1-1          The Speex codec runtime library
ii  libtheora0            1.0~beta3-1        The Theora Video Compression Codec
ii  libtiff4              3.8.2-11           Tag Image File Format (TIFF) libra
ii  libvorbis0a           1.2.0.dfsg-3.1     The Vorbis General Audio Compressi
ii  libwavpack1           4.50.1-1           an audio codec (lossy and lossless
ii  libx11-6              2:1.1.5-2          X11 client-side library
ii  libxext6              2:1.0.4-1          X11 miscellaneous extension librar
ii  libxine1-bin          1.1.16.3-1         the xine video/media player librar
ii  libxt6                1:1.0.5-3          X11 toolkit intrinsics library
ii  zlib1g                1:1.2.3.3.dfsg-12  compression library - runtime

libxine1-misc-plugins recommends no packages.

libxine1-misc-plugins suggests no packages.

-- no debconf information
--- src/demuxers/demux_rawdv.c.prev	2008-07-12 18:23:56.000000000 -0400
+++ src/demuxers/demux_rawdv.c	2009-05-31 19:42:03.000000000 -0400
@@ -302,7 +302,8 @@
   }
 
   if( !start_pos && start_time ) {
-    start_pos = (start_time * 90 / this->duration) * this->frame_size;
+    /* Upcast start_time in case sizeof(off_t) > sizeof(int) */
+    start_pos = ( (off_t) start_time * 90 / this->duration) * this->frame_size;
   }
   
   start_pos = start_pos - (start_pos % this->frame_size);  

Reply via email to