scodec/scodec-bits

1.0.10+ BitVector.fromBase64 adds trailing bytes

searler opened this issue · 3 comments

val base64 = """1MOyoQIABAAAAAAAAAAAAP//AAABAAAAPl6hVQvgDAA8AAAAPAAAAP///////wAhQwjkUwgARQAA
KEPjAABAEd9lqf4Bgan+Af/a/hOIABSGXENNRAAAAAAbqf4B/wAAAAAAAD9eoVX52QYAPAAAADwA
AAABgMIAAAAAH5AHOpIAJkJCAwAAAAAAkAAADlgwS+AAAAA3kAAADlgwS+CAAgIABgABAAQAc2Vy
YwAAAAA="""

val bv = BitVector.fromBase64(base64).get

The value of bv changed between 1.0.9, adding 3 trailing zero bytes.
1.0.9 - BitVector(1408 bits, #492692838)
1.0.10 - BitVector(1432 bits, #2100808301)

This failure occurred on Windows and the number of zero bytes matches the number of lines.
The failure does not occur if the string is a single line.

Presumably a problem with DOS eol.

Ouch! Good find, I'm sure this wasn't easy to isolate. I just pushed a new 1.0.12-SNAPSHOT that includes the fix. Can you give it a spin and let me know if it is working for you?

I tested and there were no further issues
Thanks

Thanks -- I published 1.0.12 with just this fix.