commit | bf6406041919f67219fd1829438dda28845d4c23 | [log] [tgz] |
---|---|---|
author | Songyue Han <songyueh@google.com> | Tue Oct 03 22:40:14 2023 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Nov 10 18:29:07 2023 +0000 |
tree | 3e855cf40fa62f9cb4f399060b92bb7a7a10433b | |
parent | 30b1b34cfd5abfcfee759e7d13167d368ac6c268 [diff] |
Fix convertYUV420Planar16ToY410 overflow issue for unsupported cropwidth. Bug: 300476626 Test: color_conversion_fuzzer (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:de2ad0fad97d6d97d1e01f0e8d8309536eb268b4) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:745ab99f7343bc236b88b9d63cd7b06ab192f9e9) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:aa8298ec8eb903e1e3dd915fa24f32e1aea1f76c) Merged-In: I8631426188af3c5f9b6c1ff6a0039254c252f733 Change-Id: I8631426188af3c5f9b6c1ff6a0039254c252f733
diff --git a/media/libstagefright/colorconversion/ColorConverter.cpp b/media/libstagefright/colorconversion/ColorConverter.cpp index 4b4f65f..6eae6c7 100644 --- a/media/libstagefright/colorconversion/ColorConverter.cpp +++ b/media/libstagefright/colorconversion/ColorConverter.cpp
@@ -949,7 +949,8 @@ uint32_t u01, v01, y01, y23, y45, y67, uv0, uv1; size_t x = 0; - for (; x < src.cropWidth() - 3; x += 4) { + // x % 4 is always 0 so x + 3 will never overflow. + for (; x + 3 < src.cropWidth(); x += 4) { u01 = *((uint32_t*)ptr_u); ptr_u += 2; v01 = *((uint32_t*)ptr_v); ptr_v += 2;