Closed Bug 914352 Opened 12 years ago Closed 12 years ago

fs.writeFile with an object as `path` hard crashes

Categories

(Add-on SDK Graveyard :: General, defect, P1)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jsantell, Unassigned)

References

Details

Attachments

(1 file)

Using an object as a path in fs.writeFile does a hard crash (Mozilla Crash Reporter pops up) Recreate: ``` let { writeFile } = require('sdk/io/fs'); writeFile({}, 0755, function () {}); ``` This should fail more gracefully.
Can you provide your crash report ID/link?
Flags: needinfo?(jsantell)
Editing my use-case from above (the signature is path, content, callback... there are no modes) Attached is crash report, but this is something we can appropriately protect against in our writeFile method ``` let { writeFile } = require('sdk/io/fs'); writeFile({}, 'content to write', function () {}); ``` AdapterDeviceID: 0x 166 AdapterVendorID: 0x8086 Add-ons: %7B972ce4c6-7e08-4474-a285-3208198ce6fd%7D:27.0a1,jid1-uSbgJhUtpr8yMw%40jetpack:0.1 BuildID: 20130919030202 CrashTime: 1379618253 EMCheckCompatibility: false FramePoisonBase: 7ffffffff0dea000 FramePoisonSize: 4096 InstallTime: 1379618026 Notes: AdapterVendorID: 0x8086, AdapterDeviceID: 0x 166GL Layers! GL Context? GL Context+ GL Layers+ ProductID: {ec8030f7-c20a-464f-9b0e-13a3a9e97384} ProductName: Firefox ReleaseChannel: nightly SecondsSinceLastCrash: 224 StartupTime: 1379618252 Theme: classic/1.0 Throttleable: 1 URL: about:blank Vendor: Mozilla Version: 27.0a1 useragent_locale: en-US
Flags: needinfo?(jsantell)
Attached file bug
This now throws an error -- according to node spec, this must be a string path, and cannot be a fd, and the error is not handled in the callback, which has been replicated here.
Attachment #809469 - Flags: review?(rFobic)
Attachment #809469 - Flags: review?(rFobic) → review+
Commits pushed to master at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/0fa66a9dbd2d82e3f1bed1c44104cc87bddb34a0 Bug 914352 fix crash when invalid path given to fs.writeFile https://github.com/mozilla/addon-sdk/commit/98cb343870810474c51cedd4bf6641536f97f5d3 Merge pull request #1245 from jsantell/fix-fs-writefile fix Bug 914352 fix crash when invalid path given to fs.writeFile, r=@gozala
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Depends on: 923719
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: