You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just found this code in compress/bzip2/huffman.go, line 110:
if length > pairs[i].length {
// If the code length decreases we shift in order to
// zero any bits beyond the end of the code.
length >>= 32 - pairs[i].length
length <<= 32 - pairs[i].length
length = pairs[i].length
}
I fail to see what the two shifts accomplish. Whatever the expressions do, the value is stomped by the final assignment. I'm not sure what the expected logic is here, or whether this is causing a bug of some sort. But the code seems wrong to me.
The text was updated successfully, but these errors were encountered:
I can take this. I want to re-write the bzip2 huffman decoder anyways. It's the same decoder as what's used in compress/flate, only that the the flate version is faster.
I just found this code in
compress/bzip2/huffman.go
, line 110:I fail to see what the two shifts accomplish. Whatever the expressions do, the value is stomped by the final assignment. I'm not sure what the expected logic is here, or whether this is causing a bug of some sort. But the code seems wrong to me.
The text was updated successfully, but these errors were encountered: