4 ms·
Reminds me of this bug: https://android-review.googlesource.com/c/platform/bootable/bootloader/legacy/+/14699/1/libc/memset.c https://android-review.googlesour
by DSMan195276 8y ago
Reminds me of this bug:
https://android-review.googlesource.com/c/platform/bootable/bootloader/legacy/+/14699/1/libc/memset.c https://android-review.googlesource.com/c/platform/bootable/...
Basically, when Android's libc was written they wrote `memset` wrong, such that it ignores the input parameter and always writes zeros. Nobody caught it for a while because, well, who calls `memset` with a non-zero value?
There was HN thread about it (8 years ago apparently, I feel old...):
https://news.ycombinator.com/item?id=1378912 https://news.ycombinator.com/item?id=1378912
The link itself is dead, but I managed to find the link to the code I posted above after a bit of searching.
- kuschku 8y agoThere are more funny bugs like that. For example, the result of "ab".split("") differs by android version. OpenJDK returns ["a", "b"], but older versions return ["", "a", "b"] and some even return ["", "a", "b", ""]. All this is strictly specified in the documentation and Java language specs, but no one ever bothered to fix it.
- kllrnohj 8y agoThat's not Android's libc, that's bootloader code. Android's libc is bionic and its ARM memset is here: https://android.googlesource.com/platform/bionic/+/master/libc/arch-arm/generic/bionic/memset.S https://android.googlesource.com/platform/bionic/+/master/li...
- DSMan195276 8y agoYou would be right, I guess I remembered wrong and didn't look close enough.