Logic flaw in 3to4 Encoding

Giganews Newsgroups
Subject: Logic flaw in 3to4 Encoding
Posted by:  Remy Lebeau (TeamB) (gambit…@yahoo.com)
Date: Fri, 11 Jul 2003

I think the 3to4 encoders have a basic logic flaw which is responsible for
frequent user complaints about "uneven" byte size errors.  When calling
Encode(), it first tests the byte size to see if it is an even multiple of
3.  But that is wrong.  The encoding sceme is specifically written such that
it easily supports uneven byte counts by simply appending extra bytes to the
generated output to make sure the output is the correct size for decoding.
Only decoding, not encoding, cares about having byte counts of a given size.
I know this works because I have written encoding code of my own for other
projects that work fine regardless of the input size of the original data
for encoding.

Gambit

Replies