Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/sys/sys



Module Name:    src
Committed By:   riastradh
Date:           Tue Mar 18 14:28:37 UTC 2014

Modified Files:
        src/sys/sys: endian.h

Log Message:
Avoid undefined behaviour in shifts in endian decoding routines.

If int is 32-bit and p is a uint8_t *, then p[0] is promoted to int
and p[0] << 24 can shift a one into the sign bit of an int, which is
nasal demon territory.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/sys/endian.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index