Closed Bug 1838380 Opened 2 years ago Closed 9 months ago

Strange 0 (nullptr) reference. We should use proper abort mechanism. mailnews/db/mork/morkDeque.h

Categories

(MailNews Core :: Database, defect)

x86_64
All
defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: ishikawa, Assigned: ishikawa)

Details

(Whiteboard: [snnot3p])

Attachments

(2 obsolete files)

There is a code in morkDeque.h which references a pointer value of 0.
Intention seems to be the code should crash when the program calls this function.

https://searchfox.org/comm-central/source/mailnews/db/mork/morkDeque.h#65

I am using GCC to compile TB under Debian GNU/Linux locally.
GCC has become very clever and when it sees it, the compilation fails since the code is buggy.

I think we should use proper abort mechanism such as MORK_ASSERT(0);

Come to think of it, I am not sure why GCC does not complain about |MORK_ASSERT(0)| at compile time, but I suspect there have been enough efforts to placate the compier by using enough indirection or proper pragma magic so that the compiler ignores this always fail condition in |MORK_ASSERT(0)|.

I am not sure whom I should ask the review.
Bugzilla doesn't suggest a potential reviewer.

Wayne, maybe you can assign a proper reviewer?

Flags: needinfo?(vseerror)
Attachment #9339012 - Flags: review?(mkmelin+mozilla)

Or maybe Ben

Flags: needinfo?(vseerror) → needinfo?(benc)
Comment on attachment 9339012 [details] [diff] [review] Use proper run-time assert instead of accessing a memory via null pointer. Review of attachment 9339012 [details] [diff] [review]: ----------------------------------------------------------------- Please don't add a #if 0 version, just a change with the fix. Also, please use moz-phab for submitting patches. https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html.
Attachment #9339012 - Flags: review?(mkmelin+mozilla) → review-
Assignee: nobody → ishikawa
Status: NEW → ASSIGNED

(In reply to Magnus Melin [:mkmelin] from comment #3)

Comment on attachment 9339012 [details] [diff] [review]
Use proper run-time assert instead of accessing a memory via null pointer.

Review of attachment 9339012 [details] [diff] [review]:

Please don't add a #if 0 version, just a change with the fix.
Also, please use moz-phab for submitting patches.
https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html.

All right. I have not used phabricator submission before, but I will study the document.

I'm constantly surprised by Mork :-)

The change looks good to me. As Magnus said, no point leaving in the old code. You know your stuff, so be bold!

Flags: needinfo?(benc)

(In reply to Ben Campbell from comment #5)

I'm constantly surprised by Mork :-)

The change looks good to me. As Magnus said, no point leaving in the old code. You know your stuff, so be bold!

Yes, I will submit via phabricator after proper mod of the patch.
Except, due to the busy day job and other commitments, I have realized I have not moved away from hg MQ practice YET.
I did play with evolution, etc. So hopefully in about a week, I can submit the updated patch via phabricator.
This is a very easy patch, a single chunk to a single file. So a good practice for me to use phabricator.

OS: Linux → All
Whiteboard: [snnot3p]

Hmm, I must have screwed up something.
The patch which I tried to submit via moz-phab ended up as
https://phabricator.services.mozilla.com/D184904
and not shown in this bugzilla.

(This is in contrast to the patch which DID show up in the bugzilla, Bug 673703
https://phabricator.services.mozilla.com/D184903

Flags: needinfo?(mkmelin+mozilla)
Attachment #9339012 - Attachment is obsolete: true
Flags: needinfo?(mkmelin+mozilla)

I'm not seeing any problem with the submission. D184904 is listed in this bug as it should.

I am a bit hazy what happened, but
we changed MOZ_ASSERT() into MOZ_ASSERT_UNREACHABLE() and it has been fixed that way.
So I am going to close this.

Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED

We use FIXED only when known patches resolved the issue.

Resolution: FIXED → WORKSFORME
Attachment #9346420 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: