On Tue, 28 Jan 2014 17:28:16 +0100
Aurelien Jarno <aurel...@aurel32.net> wrote:

> The problem reported by the testsuite is real, and ignoring it means
> that bzip2 compression support is broken on s390x (and other 64-bit 
> big-endian architectures).
> 
> The problem is that some pointers are casted from long to unsigned int,
> while they do not have the same size. The patch below fixes that using
> a temporary variable as the pointer. There might be better solutions
> like changing the variable type, but I leave that for the upstream.
> 
> --- libgringotts-1.2.1.orig/src/libgrg_crypt.c
> +++ libgringotts-1.2.1/src/libgrg_crypt.c
> @@ -347,10 +347,14 @@ decrypt_mem (const GRG_CTX gctx, const G
>               }
>               
>               if (gctx->comp_algo)    //bz2
> +             {
> +                     unsigned int uint_oDim = oDim;
>                       err = BZ2_bzBuffToBuffDecompress ((unsigned char *)
> -                                                       tmpData, (unsigned 
> int *) &oDim,
> +                                                       tmpData, &uint_oDim,
>                                                         (unsigned char *) 
> curdata, curlen,
>                                                         USE_BZ2_SMALL_MEM, 0);
> +                     oDim = uint_oDim;
> +             }
>               else            //zlib
>                       err = uncompress (tmpData, &oDim, curdata, curlen);
>  
> @@ -411,13 +415,16 @@ grg_encrypt_mem (const GRG_CTX gctx, con
>  
>               //compress the data
>               if (gctx->comp_algo)    //bz2
> +             {
> +                     unsigned int uint_compDim = &compDim;
>                       err = BZ2_bzBuffToBuffCompress (compData,
> -                                                     (unsigned int *)
> -                                                     &compDim,
> +                                                     &uint_compDim,
>                                                       (unsigned char *)
>                                                       origData, uncDim,
>                                                       gctx->comp_lvl * 3, 0,
>                                                       0);
> +                     compDim = uint_compDim;
> +             }
>               else
>                       err = compress2 (compData, &compDim, origData, uncDim,
>                                        gctx->comp_lvl * 3);
> 
> -- 

Thanks Aurelien for your report and patch. I added it to a new version
uploaded to mentors. And some fixes that will close the other RC bug
(736938)[0].

Ah, on line 415 the assignment should be unsigned int uint_compDim =
compDim not his pointer.

I'm sorry regard to the problems this causes. Hope this new revision
fixes all problems. Anyway there are many inconsistencies and I expect
upstream could take a look.

Regards,

[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=736938


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to