NUL-terminate strings when dumping the heap

RESOLVED FIXED in mozilla13

Status

()

Core
JavaScript Engine
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: sfink, Assigned: sfink)

Tracking

(Blocks: 1 bug)

unspecified
mozilla13
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

7 years ago
There were a couple of paths through the heap-dumping where the buffer was not NUL-terminated (when no detail was available, or when detail was available but one of the cases was chosen that didn't generate anything). With this patch, I don't seem to see any more mangled strings in the heap dump output.
(Assignee)

Comment 1

7 years ago
Created attachment 600216 [details] [diff] [review]
NUL-terminate strings when dumping the heap
Attachment #600216 - Flags: review?(continuation)
Comment on attachment 600216 [details] [diff] [review]
NUL-terminate strings when dumping the heap

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

Thanks for looking into this!

This part of OBJECT needs a null terminator in the else branch:

2545                     if (fun->atom)
2546                         PutEscapedString(buf, bufsize, fun->atom, 0);

I'm not sure what the best way to do that is.  r=me with that.
Attachment #600216 - Flags: review?(continuation) → review+
Oh, and while you are there, if you could remove the totally useless:

-#ifdef HAVE_XPCONNECT
-#include "dump_xpc.h"
-#endif

that would be great.  Thanks.
and this glob:
-#ifdef HAVE_XPCONNECT
-        if (clasp->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS) {
-            void *privateThing = obj->getPrivate();
-            if (privateThing) {
-                const char *xpcClassName = GetXPCObjectClassName(privateThing);
-                if (xpcClassName)
-                    name = xpcClassName;
-            }
-        }
-#endif
(Assignee)

Comment 5

7 years ago
(In reply to Andrew McCreight [:mccr8] from comment #2)
> This part of OBJECT needs a null terminator in the else branch:
> 
> 2545                     if (fun->atom)
> 2546                         PutEscapedString(buf, bufsize, fun->atom, 0);
> 
> I'm not sure what the best way to do that is.  r=me with that.

Doh! Didn't notice that one lurking there. It also shouldn't have a space prepended, so I moved the space into the printfs.

https://hg.mozilla.org/integration/mozilla-inbound/rev/52fe920f2685
Target Milestone: --- → mozilla15
(Assignee)

Updated

7 years ago
Target Milestone: mozilla15 → mozilla13
https://hg.mozilla.org/mozilla-central/rev/52fe920f2685
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Blocks: 723783
You need to log in before you can comment on or make changes to this bug.