regex-automata icon indicating copy to clipboard operation
regex-automata copied to clipboard

ByteOrder::read_uint looks incorrect for big endian

Open tmandry opened this issue 2 years ago • 0 comments

This code doesn't look correct for big endian:

https://github.com/BurntSushi/regex-automata/blob/8deb0dba13b72a2234830e08c1e6de2a1189bc8c/src/byteorder.rs#L37-L41

It always copies the bytes to the beginning of the 8-byte array, but then interprets them as whatever endianness is being used.

The byteorder crate copies bytes to the end for big endian.

(This issue came up in code review, not from hitting any actual bugs.)

tmandry avatar Jul 28 '21 22:07 tmandry