diff options
author | Bernd Zeimetz <bernd@bzed.de> | 2013-12-07 18:46:46 +0100 |
---|---|---|
committer | Bernd Zeimetz <bernd@bzed.de> | 2013-12-07 18:46:46 +0100 |
commit | a496a59c81173881900d976be35752787f4ab38c (patch) | |
tree | 374863c251202d7a0f5dceab0b10161726cf862b /bits.c | |
parent | 707dfb70f947f04ab8dcdf5c8e4909399dea2790 (diff) | |
download | gpsd-a496a59c81173881900d976be35752787f4ab38c.tar.gz |
Avoid a possible logic error as reported by scan-build.
Diffstat (limited to 'bits.c')
-rw-r--r-- | bits.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -63,6 +63,11 @@ int64_t sbits(signed char buf[], unsigned int start, unsigned int width, bool le { uint64_t fld = ubits((unsigned char *)buf, start, width, le); + /* ensure width > 0 as the result of + 1LL << (width - 1) + is undefined for width <= 0 */ + assert(width > 0); + /*@ +relaxtypes */ if (fld & (1LL << (width - 1))) { /*@ -shiftimplementation @*/ |