nsDeviceSensor.cpp ASSERTs in debug builds for light sensors

RESOLVED FIXED in mozilla16

Status

()

Core
DOM: Device Interfaces
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: dhylands, Assigned: dhylands)

Tracking

unspecified
mozilla16
ARM
Gonk (Firefox OS)
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
I'm hitting the following assert in B2G on debug builds:
Assertion failure: i < Length() (invalid array index), at ../../dist/include/nsTArray.h:535

This appears to be occuring with light sensors which only have a single value. The nsDeviceSensors::Notify function blindly pulls 3 values which causes the assert.
Component: Hardware Abstraction Layer (HAL) → DOM: Device Interfaces
QA Contact: hal → device-interfaces
(Assignee)

Comment 1

5 years ago
Created attachment 629033 [details] [diff] [review]
One way of resolving the problem.
Attachment #629033 - Flags: review?(doug.turner)
I would do

 const InfallibleTArray<float>& values = aSensorData.values();
 size_t len = values.Length();
 double x = len > 0 ? values[0] : 0.0;
 double y = len > 1 ? values[1] : 0.0;
 //...
(Assignee)

Comment 3

5 years ago
Created attachment 629041 [details] [diff] [review]
Proposed patch for bug 760347 v2

Bah. Humbug.

OK - I like the looks of your version better.
Attachment #629033 - Attachment is obsolete: true
Attachment #629033 - Flags: review?(doug.turner)
Attachment #629041 - Flags: review?(doug.turner)

Updated

5 years ago
Attachment #629041 - Flags: review?(doug.turner) → review+
(Assignee)

Updated

5 years ago
Whiteboard: need
(Assignee)

Updated

5 years ago
Whiteboard: need → checkin-needed
Assignee: nobody → dhylands
https://hg.mozilla.org/integration/mozilla-inbound/rev/3524b3fe9492
Whiteboard: checkin-needed

Comment 5

5 years ago
https://hg.mozilla.org/mozilla-central/rev/3524b3fe9492
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.