Closed Bug 705663 Opened 13 years ago Closed 13 years ago

Fix braindead WebGLTexture::HasImageInfoAt

Categories

(Core :: Graphics: CanvasWebGL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla11
Tracking Status
firefox8 --- wontfix
firefox9 --- fixed
firefox10 --- fixed
firefox11 --- fixed
status1.9.2 --- unaffected

People

(Reporter: bjacob, Assigned: bjacob)

References

Details

(Keywords: regression, Whiteboard: [qa-])

Attachments

(1 file)

I have no idea how I've been able to create 3 separate bugs in 3 lines of code. This was done in a rush for bug 635666.

The first bug is that (level <= mMaxLevelWithCustomImages) didn't account for the case where no image at all has been defined, so the array length is zero.

The second bug is that ImageInfoAt(level, 0) should have been ImageInfoAt(level, face).

The third bug is only theoretical: we weren't really checking for integer overflow. This couldn't really be exploited in practice though, as doing so would have required creating arrays larger than addressable space. But since this function is security-critical (see bug 635666) let's be future-proof.
Attachment #577251 - Flags: review?(jmuizelaar)
Attachment #577251 - Flags: review?(jmuizelaar) → review+
Attachment #577251 - Attachment is patch: true
http://hg.mozilla.org/mozilla-central/rev/bc48009a6bbb
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Attachment #577251 - Flags: approval-mozilla-beta?
Attachment #577251 - Flags: approval-mozilla-aurora?
Attachment #577251 - Flags: approval-mozilla-beta?
Attachment #577251 - Flags: approval-mozilla-beta+
Attachment #577251 - Flags: approval-mozilla-aurora?
Attachment #577251 - Flags: approval-mozilla-aurora+
Assignee: nobody → bjacob
Target Milestone: --- → mozilla11
I don't think we need to hide this as a security bug, there's no immediate vulnerability here.
Blocks: 635666
Group: core-security
Keywords: regression
Is this something QA can verify?
Whiteboard: [qa?]
The only useful thing to do here would be to add a unit test; ping me after holidays if you think this is worth it (the likelihood of a regression around here seems low to me). This function is used by webgl.texImage2D so a unit test would do corresponding texImage2D calls hitting the cases that were improperly handled, as described in comment 0.
I defer to your judgement to whether or not a unit test is useful here. Without it, this fix will likely not be verifiable.
Whiteboard: [qa?] → [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: