Opened 9 years ago
Closed 9 years ago
#3953 closed defect (fixed)
Fixing unaligned data access in oscam
Reported by: | Gumball3000 | Owned by: | |
---|---|---|---|
Priority: | critical | Component: | General |
Severity: | high | Keywords: | |
Cc: | Sensitive: | no |
Description
Platforms like ARM have the rule:
"word accesses must be aligned to a multiple of their size"
(see: https://wiki.debian.org/ArmEabiFixes#wor...e_of_their_size)
This basically means: never cast a char/uint8_t pointer to a bigger pointer like uint16_t, uint32_t, uint64_t. The same applies for casting a uint16_t pointer to a uint32_t pointer and so on.
Currently there are several lines in oscam which break this rule, and thus, make oscam crash if a bad aligned pointer is passed and the "/proc/cpu/alignment" is set to its default value of 0.
The attached patches fix all cases of unaligned data access in oscam that I was able to find with searching for "*)" and "* )" in all files.
Attachments (8)
Change History (11)
by , 9 years ago
Attachment: | dvbapi.patch added |
---|
by , 9 years ago
Attachment: | md5.c.patch added |
---|
by , 9 years ago
Attachment: | module-cccam.c.patch added |
---|
by , 9 years ago
Attachment: | oscam-cache.c.patch added |
---|
by , 9 years ago
Attachment: | oscam-string.c.patch added |
---|
by , 9 years ago
Attachment: | oscam-conf.c.patch added |
---|
by , 9 years ago
Attachment: | reader-videoguard.patch added |
---|
comment:2 by , 9 years ago
Fix for dvbapi patch uploaded @forum:
http://www.streamboard.tv/wbb2/attachment.php?attachmentid=54938
comment:3 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Everything is now on trunk, and should be fine.
Thanks goes to Gorgone for adding it so fast :)
by , 9 years ago
Attachment: | 1_module-cccam.c.patch added |
---|
Sorry, there is a small typo in a dvbapi line (a 4 should be a 2)
Replace
memcpy(&client_proto_ptr, &mbuf[4], 4);
With
memcpy(&client_proto_ptr, &mbuf[4], 2);
Also, be careful with r9940, these changes will make it crash.
Was this to avoid a warning?