memset() fails on negative byte value
Bug #1279700 reported by
Geoff Streeter
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Raspbian |
Expired
|
Undecided
|
Unassigned |
Bug Description
I have logged this on github bavison/arm-mem which seems appropriate but may not be. In addition that seems to be an inactive site. This might expedite things.
memset() does not honour the "converted to an unsigned char" required by 7.21.6.1 of ISO/IEC 9899:1999(E)
signed char smallint = -3;
signed char smallarray[10];
memset(smallarray, smallint, 10);
results in
smallarray[0] ←→ -3
smallarray[1] ←→ -1
smallarray[2] ←→ -1
smallarray[3] ←→ -1
smallarray[4] ←→ -3
...
code widens the smallint of -3 to int with sign extension - correctly. memset() fails to AND this with 0xff before shifting and ORing.
To post a comment you must log in.
The reported issue, https:/ /github. com/bavison/ arm-mem/ issues/ 1 , is fixed.
Does this bug still need to stay open?