Re: APR::Base64 Bug

[prev] [thread] [next] [Date index for 2005/05/22]

From: Torsten Foertsch
Subject: Re: APR::Base64 Bug
Date: 17:29 on 22 May 2005
--nextPart6577327.OUqUPQiye1
Content-Type: multipart/mixed;
  boundary="Boundary-01=_NGMkCwKPP35DZWd"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--Boundary-01=_NGMkCwKPP35DZWd
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Sunday 22 May 2005 19:18, Torsten Foertsch wrote:
> there is something wrong with APR::Base64.
>
> r2@opi:~> perl -MAPR::Base64 -MData::Dumper -e '$x=3DAPR::Base64::encode(=
 "x"
> ); print "$x\n".Dumper( [split "", $x] ), "length=3D".length($x)."\n";' e=
A=3D=3D
> $VAR1 =3D [
>           'e',
>           'A',
>           '=3D',
>           '=3D',
>           ''
>         ];
> length=3D5
> r2@opi:~> perl -MAPR::Base64 -MData::Dumper -e '$x=3DAPR::Base64::encode(
> "xxx" ); print "$x\n".Dumper( [split "", $x] ), "length=3D".length($x)."\=
n";'
> eHh4
> $VAR1 =3D [
>           'e',
>           'H',
>           'h',
>           '4',
>           ''
>         ];
> length=3D5
>
> In both cases length should be 4 and split("",$x) should return (qw(e a =
=3D
> =3D)).

the attached t/lib/TestAPRlib/base64.pm fails on the bug:

t/apr-ext/base64....1..3
# Running under perl version 5.008005 for linux
# Current time local: Sun May 22 19:24:51 2005
# Current time GMT:   Sun May 22 17:24:51 2005
# Using Test.pm version 1.25
# Using Apache/Test.pm version 1.25
# encoded string: MTIzNDVxd2VydCFAIyQl
# testing : encode
# expected: MTIzNDVxd2VydCFAIyQl
# received: MTIzNDVxd2VydCFAIyQl
not ok 1
# Failed test 1=20
in /usr/src/packages/BUILD/mod_perl-2.0.0/t/lib/TestAPRlib/base64.pm at lin=
e=20
23
# testing : encoded length
# expected: 21
# received: 21
ok 2
# testing : decode
# expected: 12345qwert!@#$%
# received: 12345qwert!@#$%
ok 3
=46AILED test 1

--Boundary-01=_NGMkCwKPP35DZWd
Content-Type: application/x-perl-module;
  name="base64.pm"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="base64.pm"

package TestAPRlib::base64;

# testing APR::Base64 API

use strict;
use warnings FATAL => 'all';

use Apache::Test;
use Apache::TestUtil;

use APR::Base64;

sub num_of_tests {
    return 3;
}

sub test {

    my $str = '12345qwert!@#$%';
    my $encoded = APR::Base64::encode($str);

    t_debug("encoded string: $encoded");
    ok t_cmp($encoded, 'MTIzNDVxd2VydCFAIyQl', 'encode');

    ok t_cmp(APR::Base64::encode_len(length $str),
             length $encoded,
             "encoded length");

    ok t_cmp(APR::Base64::decode($encoded), $str, "decode");

}

1;

--Boundary-01=_NGMkCwKPP35DZWd--

--nextPart6577327.OUqUPQiye1
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQBCkMGSwicyCTir8T4RAuI/AKCerGlzw7JEM/opeC6NRvLc/pv1wgCePoQ8
r58ivCN8S7jJXFLNzBQ+VE8=
=LTXM
-----END PGP SIGNATURE-----

--nextPart6577327.OUqUPQiye1--

(message missing)

Re: APR::Base64 Bug
Torsten Foertsch 17:29 on 22 May 2005

Re: APR::Base64 Bug
Torsten Foertsch 20:15 on 23 May 2005

Re: APR::Base64 Bug
Stas Bekman 20:57 on 23 May 2005

Re: APR::Base64 Bug
Torsten Foertsch 07:19 on 24 May 2005

Re: APR::Base64 Bug
Stas Bekman 15:23 on 24 May 2005

Generated at 15:53 on 25 May 2005 by mariachi v0.52