Closed Bug 1360152 Opened 3 years ago Closed 3 years ago

[Static Analysis][Coverity] /js/src/jsopcode.cpp: 1189 Execution cannot reach this statement: "js::ReportOutOfMemory(cx);".

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: kanru, Assigned: tromey)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1405540)

Attachments

(1 file)

The change in bug 1334278 changed the return value JS_smprintf to UniqueChars but didn't remove this OOM check:

*** CID 1405540:  Control flow issues  (DEADCODE)
/js/src/jsopcode.cpp: 1189 in ToDisassemblySource(JSContext *, JS::Handle<JS::Value>, JSAutoByteString *)()
1183                 return false;
1184             char* nbytes = QuoteString(&sprinter, v.toString(), '"');
1185             if (!nbytes)
1186                 return false;
1187             UniqueChars copy = JS_smprintf("%s", nbytes);
1188             if (!nbytes) {
>>>     CID 1405540:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "js::ReportOutOfMemory(cx);".
1189                 ReportOutOfMemory(cx);
1190                 return false;
1191             }
1192             bytes->initBytes(Move(copy));
1193             return true;
1194         }

If the OOM report is still need we should change it to |if (!copy)|
Flags: needinfo?(ttromey)
Whiteboard: CID 1405540
My bad.
Assignee: nobody → ttromey
Flags: needinfo?(ttromey)
Comment on attachment 8862431 [details]
Bug 1360152 - null-check correct value in ToDisassemblySource;

https://reviewboard.mozilla.org/r/134362/#review137310

Doh!
Attachment #8862431 - Flags: review?(nfroyd) → review+
Comment on attachment 8862431 [details]
Bug 1360152 - null-check correct value in ToDisassemblySource;

https://reviewboard.mozilla.org/r/134362/#review137310

We may want to consider uplifting this if appropriate.
Pushed by ttromey@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5a2d5f57d453
null-check correct value in ToDisassemblySource; r=froydnj
https://hg.mozilla.org/mozilla-central/rev/5a2d5f57d453
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.