warning C4789: destination of memory copy is too small in nsCSSScanner.cpp




8 years ago
6 years ago


(Reporter: RyanVM, Unassigned)


(Blocks: 1 bug)

Windows 7
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [build_warning], URL)


(1 attachment, 1 obsolete attachment)



8 years ago
This warning showed up recently on my own builds. Doesn't seem to be showing up on Tinderbox. I do PGO builds with MSVC 2010 with -O2 -GL.
c:\mozbuild\mozilla-central\layout\style\nscssscanner.cpp(736) : warning C4789: destination of memory copy is too small


8 years ago
Whiteboard: [build_warning]

Comment 1

8 years ago

721 PRBool
722 nsCSSScanner::Next(nsCSSToken& aToken)
734     // IDENT
735     if (StartsIdent(ch, Peek()))
736       return ParseIdent(ch, aToken);

Comment 2

8 years ago
This seems to have been tied to the optimization settings I was using. Whatever the reason, it's gone now.
Last Resolved: 8 years ago
Resolution: --- → WORKSFORME

Comment 3

7 years ago
I still see this on MSVC 2010 PGO builds with no optimizations enabled. This looks potentially bad. Maybe a bug with MSVC, but is there a way to mitigate it?
Resolution: WORKSFORME → ---


7 years ago
What line is the trunk warning on?
Erm.  Line 726 shouldn't have any memory copies....

Comment 7

7 years ago
Dunno, but I just checked again.
c:\mozbuild\mozilla-central\layout\style\nscssscanner.cpp(726) : warning C4789: destination of memory copy is too small
If you inline ParseIdent at that point manually, which line does it complain on?

Comment 9

7 years ago
Posted patch Inline ParseIdent (obsolete) — Splinter Review
Here's what I'm trying now. Will post back in a couple hours with results.

Comment 10

7 years ago
Now it's giving the warning on this line:
if (!GatherIdent(ch, ident)) {
Alright.  Can you try inlining that too?

Comment 12

7 years ago
This is what I'm testing now. I'm pretty sure I did it right, but I would appreciate if you could give it a quick look to make sure I didn't screw something up.
Attachment #583951 - Attachment is obsolete: true
Comment on attachment 583987 [details] [diff] [review]
Inline ParseIdent and GatherIdent

Yeah, looks reasonable.

Comment 14

7 years ago
      else if (0 < ch) {
>>>     ident.Append(ch);
Hrm.  And this is a _compile_ time warning???

Comment 16

7 years ago
No, while linking xul.lib on the second pass.

Comment 17

7 years ago
Is there anything more I can do to help move this along?
I have no idea what's going on here.  :(  In general, our string append code should.. kinda work.  We use it all over....

Comment 19

7 years ago
This also happens with tinderbox PGO builds now that they've been switched over to using VC10.
Blocks: 563318

Comment 20

7 years ago
At the risk of shouting more into the Grand Canyon, can someone at least say if this bug is just a nuisance or something worse? This is shipping in nightlies now.

From MSDN:
Warns about buffer overrun when specific C run-time (CRT) functions are used, parameters are passed, and assignments are performed, such that the data sizes are known at compile time. This warning is for situations that might elude typical data-size mismatch detection.
That's the problem.  I wish I could tell what MSVC _thinks_ is going on here....  :(
You need to log in before you can comment on or make changes to this bug.