2013/3/21 Christopher Schultz <ch...@christopherschultz.net>: > Konstantin, > > On 3/19/13 6:09 AM, Konstantin Kolinko wrote: >>> } else if (data[end - 1] == PADDING) { >>> - b1 = DECODING_TABLE[data[end - 4]]; >>> - b2 = DECODING_TABLE[data[end - 3]]; >>> - b3 = DECODING_TABLE[data[end - 2]]; >>> + b1 = DECODING_TABLE[data[end - MASK_4BITS]]; >>> + b2 = DECODING_TABLE[data[end - BYTES_PER_UNENCODED_BLOCK]]; >>> + b3 = DECODING_TABLE[data[end - MASK_2BITS]]; >> >> >> ??? (A question to commons team though). >> >> I do not know FileUpload code, but from my generic knowledge of base64, >> the above replacement is suspicious. >> >> I think the above replacement of 2,3,4 with constants is incorrect. >> They are just indexes in the table. > > +1 > > The code will still run properly but if the constants were ever to be > changed (which they shouldn't!), chaos would ensue. It's also misleading > to read the code. >
This particular change has been reverted in Commons Fileupload in one of subsequent commits [1], which Mark picked up in subsequent merges. The final patch that was ported to Tomcat 7 did not have anything of the above. [1] http://svn.apache.org/viewvc?view=revision&revision=1457865 Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org