Closed Bug 1531638 Opened 8 months ago Closed 7 months ago

Make Vector::begin() always return a non-null pointer

Categories

(Core :: MFBT, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: Waldo, Assigned: Waldo)

References

Details

Attachments

(1 file)

Some users in sufficiently-generic code need this. For example, if you pass .begin()/.length() to memcmp, it's UB if the pointer passed is null, even if corresponding length is null. In a less silly case, something like the JS parser that accepts pointer/length of source might want to use |nullptr| as a sentinel value internally, and |Vector::begin()| returning that would disrupt that plan when passed empty source stored in a Vector. (This was the reason for the backout of bug 1519097 and the motivation for the additional patch added as workaround for this, on relanding.)

I have a patch for this, but someone decided to disable review flags and I have not yet undergone the pain of setting up Phabricator (which despite appearances is a four-letter word), so...tomorrow.

Pushed by jwalden@mit.edu:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e5d9f2ee7ac7
Make Vector::begin() always return a non-null pointer, to accommodate users that need this.  r=froydnj
Attachment #9047918 - Attachment is obsolete: true

Backed out for perma fails and Spidermonkey fails.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1532005#c6

Depends on: 1533636
Attachment #9047918 - Attachment description: Bug 1531638 - Make Vector::begin() always return a non-null pointer, to accommodate users that need this. r=froydnj → Bug 1531638 - Make Vector::begin() always return a non-null pointer, to accommodate users that need/want this. r=froydnj
Attachment #9047918 - Attachment is obsolete: false
Depends on: 1533640
Pushed by jwalden@mit.edu:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0a0194cd76a7
Make Vector::begin() always return a non-null pointer, to accommodate users that need/want this.  r=froydnj
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Depends on: 1538098
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
No longer depends on: 1538098

I'll give it a day or so to show that the other backout ended the crashes, then once we have that in I'm going to reland this.

Pushed by jwalden@mit.edu:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6064fb8e88fe
Make Vector::begin() always return a non-null pointer, to accommodate users that need/want this.  r=froydnj
Status: REOPENED → RESOLVED
Closed: 7 months ago7 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.