Skip to content

Commit

Permalink
VP8LSubtractGreenFromBlueAndRed_C: clear int sanitizer warnings
Browse files Browse the repository at this point in the history
previously the types were changed to int to prevent unsigned overflow
warnings:
6ab496e fix some 'unsigned integer overflow' warnings in ubsan

clears warnings of the form:
implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
3724541952 (32-bit, unsigned) to type 'int' changed the value to
-570425344 (32-bit, signed)

implicit conversion from type 'int' of value -3361661 (32-bit, signed)
to type 'unsigned int' changed the value to 4291605635 (32-bit,
unsigned)

Bug: b/229626362
Change-Id: If1eb39c5dd7218d686c3c47fb7df72431b873be4
  • Loading branch information
jzern committed Aug 9, 2022
1 parent 2ee786c commit 5037220
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dsp/lossless_enc.c
Expand Up @@ -522,11 +522,11 @@ static void GetCombinedEntropyUnrefined_C(const uint32_t X[],
void VP8LSubtractGreenFromBlueAndRed_C(uint32_t* argb_data, int num_pixels) {
int i;
for (i = 0; i < num_pixels; ++i) {
const int argb = argb_data[i];
const int argb = (int)argb_data[i];
const int green = (argb >> 8) & 0xff;
const uint32_t new_r = (((argb >> 16) & 0xff) - green) & 0xff;
const uint32_t new_b = (((argb >> 0) & 0xff) - green) & 0xff;
argb_data[i] = (argb & 0xff00ff00u) | (new_r << 16) | new_b;
argb_data[i] = ((uint32_t)argb & 0xff00ff00u) | (new_r << 16) | new_b;
}
}

Expand Down

0 comments on commit 5037220

Please sign in to comment.