Closed Bug 282806 Opened 20 years ago Closed 7 years ago

Using _alloca in a loop can overflow stack warning in nsDispatchSupport.cpp

Categories

(Core :: XPConnect, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: David.R.Gardiner, Assigned: dbradley)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

PREfast static code analysis warning:

nsdispatchsupport.cpp(78) : warning 263: Using _alloca in a loop. This can
quickly overflow stack.
problem occurs in function 'ClassIsListed'

Line 78 is this:

if(SUCCEEDED(::CLSIDFromString(T2OLE(szCLSID), &clsidToCompare)) && 

I think this is related to the T2OLE macro.

In
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_atl_string_conversion_macros.asp
they mention that the ATL 7.0 macros are better behaved. Not sure if we can
require ATL 7.0 though.

-dave

Reproducible: Always

Steps to Reproduce:
Reporter, please file xpconnect bugs against their component.

/be
Assignee: general → dbradley
Component: JavaScript Engine → XPConnect
That conversion should be moved outside of the loop. I'll post a patch 
shortly. It's such an innocent looking macro. What it actually does is 
allocate space on the stack for each invocation and that doesn't get released 
until the function exists.
Status: NEW → ASSIGNED
Sorry about picking the wrong component - I knew the code was in the JS
hierarchy, and even checked Bugzilla's component descriptions (but i only looked
around the Javascript one :-( ). It might be worth updating the Javascript
description to note that XPConnect has a separate component.

-dave
Blocks: 283681
QA Contact: pschwartau → xpconnect
I don't see T2OLE anywhere.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.