Closed Bug 962208 Opened 12 years ago Closed 7 years ago

xpcshell's readline function truncates its result after 255 characters

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED INACTIVE

People

(Reporter: florian, Unassigned)

References

Details

Attachments

(1 file)

The ReadLine function uses a 4k buffer at: http://hg.mozilla.org/mozilla-central/annotate/1b52aa569ced/js/xpconnect/src/XPCShellImpl.cpp#l210 211 ReadLine(JSContext *cx, unsigned argc, jsval *vp) 212 { 213 CallArgs args = CallArgsFromVp(argc, vp); 214 215 // While 4096 might be quite arbitrary, this is something to be fixed in 216 // bug 105707. It is also the same limit as in ProcessFile. 217 char buf[4096]; But calls GetLine which has a buffer of size 256 at: http://hg.mozilla.org/mozilla-central/annotate/1b52aa569ced/js/xpconnect/src/XPCShellImpl.cpp#l200 197 static bool 198 GetLine(JSContext *cx, char *bufp, FILE *file, const char *prompt) { 199 { 200 char line[256] = { '\0' }; Truncating after 255 characters makes the readline function quite disappointing (if not fully unusable for scripts passing JSON around). The attached patch copies the implementation from the js shell which doesn't have this limitation. The patch is imperfect and already bitrotted, but I thought I would share, just in case someone runs into the same issue. I'm not going to work more on this in the near future, anybody interested should feel free to update the patch/write another better patch.
I just verified that as of Firefox 48 the limit is 1024 when input comes from a TTY. Same for current Nightly.
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: