Closed
Bug 128215
Opened 23 years ago
Closed 22 years ago
nsIScriptableInputStream can not handle embedded \0 characters.
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
DUPLICATE
of bug 170585
Future
People
(Reporter: markh, Assigned: dougt)
Details
(Keywords: helpwanted)
Came up on IRC. nsIScriptableInputStream defines read as: string read(in unsigned long aCount); This does not handle embedded \0 characters. The "correct" fix is probably to use a byte array, but this makes usage from javascript a pain for the common case, and would be a nightmare to fix all the old code. Therefore I propose a new: void readBinary(in unsigned long aCount, out PRUint32 outCount, [retval, array, size_is(outCount)] out PRUint8 data); Then anyone who cares about binary data can go through the pain of that extra param and array management. (Of course, PyXPCOM handles all that magically, so would look like a normal read, but that isn't really relevant ;-) I'm happy to make a patch is there is agreement.
Can we use the new ACString stuff? jag? void read(in unsigned long aCount, [retval] out ACString buf);
Comment 2•23 years ago
|
||
darin?
Comment 3•23 years ago
|
||
hmm... brendan said that an octet array would be best, but that it would also be slow until JS2 comes along. cc'ing nisheeth since he did the xpconnect work... i wonder how xpconnect treats embedded nulls.
Comment 4•23 years ago
|
||
speaking to jag about this... he will update this bug soon...
Comment 5•23 years ago
|
||
Sure, |ACString| should be fine, as long as the supplying end provides a ptr + length. If only given a ptr, we'll do a \0 search.
Comment 6•23 years ago
|
||
Shaver: why the retval fu though? ACString read(in unsigned long aCount); should work just fine.
That would be too clear! Ahem. The [retval] foo came from a string-with-size attempt that predated my ACString suggestion in my mind, if not in the bug. Thanks for the clue.
Assignee | ||
Comment 8•23 years ago
|
||
Feel free to reassign or to move tm back with a working patch. :-)
Keywords: helpwanted
Target Milestone: --- → mozilla1.2
Assignee | ||
Updated•22 years ago
|
Target Milestone: mozilla1.2alpha → Future
Comment 9•22 years ago
|
||
*** This bug has been marked as a duplicate of 170585 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•