Closed Bug 1833213 Opened 3 years ago Closed 3 years ago

CanvasRenderingContext2D::getImageData() could return inconsistent data if canvas randomization is enabled.

Categories

(Core :: Privacy: Anti-Tracking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: timhuang, Assigned: timhuang)

References

(Blocks 1 open bug)

Details

Crash Data

Attachments

(1 file)

On the canvas test page, https://arkenfox.github.io/TZP/tests/canvasnoise.html, we will get inconsistent canvas fingerprints between the first and second canvas data extraction. This is because we also change the image buffer of the canvas data when we introduce the random noises. The random noises will cause the noises to be changed at the second extraction.

To fix this issue, we can cache the canvas random key when we calculate the canvas key at the first data extraction and use it further. This can improve the performance as well.

When introducing the random noises to the image data in
CanvasRenderingContext2D::GetImageDataArray would also alter the actual
image buffer. This will change the random noises every time we call the
function because the random noises is generated according to the image
data. This is undesirable and the random noises should remain the
same in the browsing session with the same canvas.

To fix this issue, we clone the actual image data if canvas randomization is
enabled and introduce noises to the cloned data, which doesn't change
the actual image buffer. So, the random nosies will remain consistent in
a single browser session.

We also fix some minor issues in this patch.

Pushed by tihuang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0acecb60f1d5 Clone the image data if canvas randomization is enabled in CanvasRenderingContext2D::GetImageDataArray(). r=tjr,lsalzman
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
Duplicate of this bug: 1833580

Copying crash signatures from duplicate bugs.

Crash Signature: [@ memcpy | SHA256_Update_Generic]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: