nmh-workers
[Top] [All Lists]

[Nmh-workers] nmh 1.5 doesn't work on 64-bit big-endian archs (+patch)

2012-06-14 03:29:31
i've run into another gotcha: the base64-decoder doesn't
work on 64-bit big-endian architectures: mhstore and co. write
files of the correct length but which consist only of \0s.

the culprit is uip/mhparse.c, which contains a pretty ugly base64
decoder (in two places). that thing allocates a "long int" as a container
for the 24 bits that you get from four base-64 chars. the container is then
accessed both as a single entity and as a byte array, which naturally 
depends on how wide the long int is and in what order things end up in there.

the code distinguishes between big- and little-endian systems but wrongly 
assumes that sizeof(long int) == 4, which isn't universally 
true (quel surprise...).

the attached patch fixes the issue, but in the long run we should
insist on posix and use a64l().

regards
az

Attachment: 05-base64-64bit-bigendian.dpatch
Description: Text Data

-- 
Alexander Zangerl + GnuPG Keys 0x42BD645D or 0x5B586291 + http://snafu.priv.at/
Perl is like vise grips. You can do anything with it but it is 
the wrong tool for every job. -- Bruce Eckel

Attachment: signature.asc
Description: Digital Signature

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers
<Prev in Thread] Current Thread [Next in Thread>