Closed Bug 790503 Opened 7 years ago Closed 7 years ago

On Mac Mini, defaultCalibration reads outside of sensors[]

Categories

(Core :: Hardware Abstraction Layer (HAL), defect, critical)

x86_64
macOS
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: jruderman, Assigned: dougt)

References

(Blocks 1 open bug)

Details

(Keywords: crash, testcase, Whiteboard: [asan])

Attachments

(4 files)

Attached file testcase
1. Build Firefox with Address Sanitizer.
  https://developer.mozilla.org/en-US/docs/Building_Firefox_with_Address_Sanitizer

2. Run Firefox on a Mac without a sudden motion sensor, such as a Mac Mini.
3. Load the testcase.

Result: ASan reports that defaultCalibration in smslib.mm reads past the end of sensors[].

After the loop in smsStartup finds no sensors, sensorNum is SENSOR_COUNT.  smsStartup returns |failure_result|, but EnableSensorNotifications ignores this return value.
Attached file stack trace from ASan
Attached file stack trace from gdb
Whiteboard: [asan]
Assignee: nobody → doug.turner
Attached patch patch v.1Splinter Review
I haven't tested/compiled this, but it should probably work.
Attachment #660311 - Flags: review?(jruderman)
Comment on attachment 660311 [details] [diff] [review]
patch v.1

This fixes the bug for me.  But I think you should get code review from a peer. And remove the trailing whitespace.
Attachment #660311 - Flags: review?(jruderman) → feedback+
Comment on attachment 660311 [details] [diff] [review]
patch v.1

Review of attachment 660311 [details] [diff] [review]:
-----------------------------------------------------------------

i'll get the whitespace before I check-in.
Attachment #660311 - Flags: review?(blassey.bugs)
Attachment #660311 - Flags: review?(blassey.bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/bae96aa5f1ad
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in before you can comment on or make changes to this bug.