Commit 5f6f4a99 authored by danakj's avatar danakj Committed by Chromium LUCI CQ

Use skia.mojom.BitmapN32 in QRCode mojoms

These bitmaps are safer for transport from untrustworthy sources since
all bitmaps should be in N32 format and the browser can make bad
assumptions as a result.

R=dcheng@chromium.org, sebsg@chromium.org

Bug: 1144462
Change-Id: I308ab745a5bfac1696be89e181b100d33db5d602
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2580026Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarsebsg <sebsg@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835198}
parent b96404b0
...@@ -70,10 +70,6 @@ void QRCodeGenerationRequest::OnGenerateCodeResponse( ...@@ -70,10 +70,6 @@ void QRCodeGenerationRequest::OnGenerateCodeResponse(
env, java_qr_code_generation_request_, nullptr); env, java_qr_code_generation_request_, nullptr);
return; return;
} }
// The QRCode service should be sending us N32 32bpp bitmaps in reply,
// otherwise this can lead to out-of-bounds mistakes when transferring the
// pixels out of the bitmap into other buffers.
CHECK_EQ(service_response->bitmap.colorType(), kN32_SkColorType);
// Convert the result to a Java Bitmap. // Convert the result to a Java Bitmap.
ScopedJavaLocalRef<jobject> java_bitmap = ScopedJavaLocalRef<jobject> java_bitmap =
......
...@@ -56,7 +56,7 @@ struct GenerateQRCodeResponse { ...@@ -56,7 +56,7 @@ struct GenerateQRCodeResponse {
// Image data for generated QR code. May be null on error, or if rendering // Image data for generated QR code. May be null on error, or if rendering
// was not requested. // was not requested.
skia.mojom.BitmapWithArbitraryBpp? bitmap; skia.mojom.BitmapN32? bitmap;
// QR Code data. // QR Code data.
array<uint8> data; array<uint8> data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment