Comment 5 for bug 11949

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <email address hidden>
Date: Thu, 25 Nov 2004 23:10:06 +0100
From: Julien BLACHE <email address hidden>
To: Debian Bug Tracking System <email address hidden>
Subject: libogg0: not 64bit clean

--===============7325652775479110625==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: libogg0
Version: 1.1.0-1
Severity: important
Tags: patch

Hi,

libogg0 is not 64bit clean as it assumes sizeof(int) == sizeof(long); it is
especially problematic when dealing with bitwise operations, as does half of
libogg...

As it happens, it is not possible to read an OGG file containing a Theora
stream without this patch, as libtheora will (correctly) fail to recognize the
Theora stream.

The attached patch fixes the problem, by using an unsigned int instead of an
unsigned long. The two modified functions manipulate bits 0-31 as indicated in
the comments above the functions, so it's safe.

A first patch was sent over 2 years ago to the theora-dev list...

Please apply,

JB.

-- System Information:
Debian Release: 3.1
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.9
Locale: LANG=C, LC_CTYPE=fr_FR@euro (charmap=ISO-8859-15)

Versions of packages libogg0 depends on:
ii libc6 2.3.2.ds1-18 GNU C Library: Shared libraries an

-- no debconf information

--===============7325652775479110625==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="libogg_bitwise.c_64bit_fix.patch"

--- libogg-1.1.0.orig/src/bitwise.c
+++ libogg-1.1.0/src/bitwise.c
@@ -250,7 +250,7 @@

 /* Read in bits without advancing the bitptr; bits <= 32 */
 long oggpackB_look(oggpack_buffer *b,int bits){
- unsigned long ret;
+ unsigned int ret;
   int m=32-bits;

   bits+=b->endbit;
@@ -346,14 +346,14 @@

 /* bits <= 32 */
 long oggpackB_read(oggpack_buffer *b,int bits){
- unsigned long ret;
+ unsigned int ret;
   long m=32-bits;

   bits+=b->endbit;

   if(b->endbyte+4>=b->storage){
     /* not the main path */
- ret=-1UL;
+ ret=-1U;
     if(b->endbyte*8+bits>b->storage*8)goto overflow;
   }

--===============7325652775479110625==--