Closed Bug 463039 Opened 16 years ago Closed 16 years ago

validate values that get passed to clearWatch

Categories

(Core :: DOM: Geolocation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.1

People

(Reporter: dougt, Assigned: dougt)

Details

(Keywords: fixed1.9.1)

Attachments

(2 files)

We should ensure that the value passed to clearWatch is something that can be in the array. Test for > 0 and < Max
i am also going to convert our code from using unsigned shorts to longs to make the current specification (which uses signed ints). This may change, but until it does we should do the right thing.
Attached patch patch v.1Splinter Review
Attachment #346483 - Flags: superreview?(jst)
Attachment #346483 - Flags: review?(jst)
Flags: blocking1.9.1?
Comment on attachment 346483 [details] [diff] [review] patch v.1 nsGeolocation::ClearWatch(PRInt32 aWatchId): + PRUint32 count = mWatchingCallbacks.Length(); + + if (aWatchId < 0 || count == 0 || aWatchId > count + 1) + return NS_ERROR_FAILURE; That should be aWatchId > count, not count + 1. r+sr=jst with that.
Attachment #346483 - Flags: superreview?(jst)
Attachment #346483 - Flags: superreview+
Attachment #346483 - Flags: review?(jst)
Attachment #346483 - Flags: review+
Flags: blocking1.9.1? → blocking1.9.1+
Target Milestone: --- → mozilla1.9.1b2
Comment on attachment 346483 [details] [diff] [review] patch v.1 a=beltzner since it comes in a bundle with the blockers
Target Milestone: mozilla1.9.1b2 → mozilla1.9.1
pushed a1364547a182.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
This patch added this compile warning: mozilla/dom/src/geolocation/nsGeolocation.cpp:720: warning: comparison between signed and unsigned integer expressions The responsible comparison is "aWatchId > count", since aWatchId is signed and count is signed. We should be fine to avoid this warning by casting aWatchId to unsigned, because if we actually hit this comparison, that implies we've already failed the "if (aWatchId < 0)" comparison, and so aWatchId is non-negative.
Version: unspecified → Trunk
Comment on attachment 375752 [details] [diff] [review] followup patch to fix build warning r=me. i wrote the same patch and was going to file a bug.
Attachment #375752 - Flags: review?(doug.turner) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: