unchecked result of mktemp before passing to fdopen

RESOLVED FIXED in Firefox 55

Status

()

--
minor
RESOLVED FIXED
2 years ago
a year ago

People

(Reporter: jesup, Assigned: jesup)

Tracking

52 Branch
mozilla55
Points:
---

Firefox Tracking Flags

(firefox55 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
Long-standing minor bug

** CID 1307869:  Error handling issues  (NEGATIVE_RETURNS)
/xpcom/build/LateWriteChecks.cpp: 161 in LateWriteObserver::Observe(mozilla::IOInterposeObserver::Observation &)()


________________________________________________________________________________________________________
*** CID 1307869:  Error handling issues  (NEGATIVE_RETURNS)
/xpcom/build/LateWriteChecks.cpp: 161 in LateWriteObserver::Observe(mozilla::IOInterposeObserver::Observation &)()
155         MOZ_CRASH("Um, how did we get here?");
156       }
157     
158       stream = _fdopen(fd, "w");
159     #else
160       int fd = mkstemp(name);
>>>     CID 1307869:  Error handling issues  (NEGATIVE_RETURNS)
>>>     "fd" is passed to a parameter that cannot be negative.
161       stream = fdopen(fd, "w");
162     #endif
163     
164       SHA1Stream sha1Stream(stream);
165     
166       size_t numModules = stack.GetNumModules();
(Assignee)

Comment 1

2 years ago
Created attachment 8843326 [details] [diff] [review]
error-check mkstemp()

MozReview-Commit-ID: 1z3cQXioTXP
(Assignee)

Updated

a year ago
Attachment #8843326 - Flags: review?(nfroyd)
Comment on attachment 8843326 [details] [diff] [review]
error-check mkstemp()

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

I guess this is consistent with the Windows code, but it seems like we should just return in both cases if we can't get a temp file.  Anyway, r=me.
Attachment #8843326 - Flags: review?(nfroyd) → review+
https://hg.mozilla.org/mozilla-central/rev/acf2c7b496d5
Status: NEW → RESOLVED
Last Resolved: a year ago
status-firefox55: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.