Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc37612e authored by Dan Austin's avatar Dan Austin
Browse files

Enable fsanitize-unsigned-integer for G711 soft decoder.

Enable fsanitize-unsigned-integer for the G711 soft decoder
and refactor the while loops in DecodeALaw and DecodeMLaw
to not trigger the sanitizer upon completion.

Bug: 23110888
Change-Id: I473b430279ab21e9e7c4f854cdae449a53ad82bc
parent 1d144929
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -16,6 +16,6 @@ LOCAL_MODULE_TAGS := optional


LOCAL_CFLAGS += -Werror
LOCAL_CFLAGS += -Werror
LOCAL_CLANG := true
LOCAL_CLANG := true
LOCAL_SANITIZE := signed-integer-overflow
LOCAL_SANITIZE := signed-integer-overflow unsigned-integer-overflow


include $(BUILD_SHARED_LIBRARY)
include $(BUILD_SHARED_LIBRARY)
+4 −2
Original line number Original line Diff line number Diff line
@@ -262,7 +262,8 @@ void SoftG711::onQueueFilled(OMX_U32 /* portIndex */) {
// static
// static
void SoftG711::DecodeALaw(
void SoftG711::DecodeALaw(
        int16_t *out, const uint8_t *in, size_t inSize) {
        int16_t *out, const uint8_t *in, size_t inSize) {
    while (inSize-- > 0) {
    while (inSize > 0) {
        inSize--;
        int32_t x = *in++;
        int32_t x = *in++;


        int32_t ix = x ^ 0x55;
        int32_t ix = x ^ 0x55;
@@ -288,7 +289,8 @@ void SoftG711::DecodeALaw(
// static
// static
void SoftG711::DecodeMLaw(
void SoftG711::DecodeMLaw(
        int16_t *out, const uint8_t *in, size_t inSize) {
        int16_t *out, const uint8_t *in, size_t inSize) {
    while (inSize-- > 0) {
    while (inSize > 0) {
        inSize--;
        int32_t x = *in++;
        int32_t x = *in++;


        int32_t mantissa = ~x;
        int32_t mantissa = ~x;