Caught by Clang with -Werror=conditional-uninitialized, inside JPEG2000Decoder::decode(): /app/webkit/Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:546:56: error: variable 'a' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] int adjustedAlpha = image->numcomps > 3 ? (a >> adjust[3]) + ((a >> (adjust[3] - 1)) % 2) : 0xFF; ^ /app/webkit/Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:506:27: note: initialize the variable 'a' to silence this warning int r, g, b, a; ^ = 0 1 error generated.
Now that I think of it... The mishandling of alpha might related to the decoding artifacts reported in bug #244528 (or at least be part of the issue).
Pull request: https://github.com/WebKit/WebKit/pull/5166
(In reply to Adrian Perez from comment #1) > Now that I think of it... The mishandling of alpha might related to the > decoding artifacts reported in bug #244528 (or at least be part of the > issue). *Narrator voice*: It wasn´t.
I don't see how this can happen because a is initialized when image->numcomps > 3 and only used when image->numcomps > 3 too.
(In reply to Carlos Garcia Campos from comment #4) > I don't see how this can happen because a is initialized when > image->numcomps > 3 and only used when image->numcomps > 3 too. I took another look at the code and you are right, but of course the compiler cannot completely reason about the code and produces a warning... so in the end I am only silencing the warning in my patch 🤦️ Still, I think we can merge it to contribute a bit to cleaner build output logs.
Sure, it doesn't hurt, but let's change the bug title and commit message to make it clear it's not fixing anything, but just silencing a warning.
Committed 255674@main (9a76ccc77f6e): <https://commits.webkit.org/255674@main> Reviewed commits have been landed. Closing PR #5166 and removing active labels.
<rdar://problem/101290537>