WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
11336
HashTable.h not zeroing pointers in constructor
https://bugs.webkit.org/show_bug.cgi?id=11336
Summary
HashTable.h not zeroing pointers in constructor
Michael Emmel
Reported
2006-10-17 17:57:34 PDT
In debug mode the new m_next and m_previous pointers are net set to zero leadin to crashes.
Attachments
zero pointers in constructor HashTable.h
(544 bytes, patch)
2006-10-17 17:58 PDT
,
Michael Emmel
no flags
Details
Formatted Diff
Diff
Missed the second constructor
(752 bytes, patch)
2006-10-17 18:02 PDT
,
Michael Emmel
darin
: review-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Michael Emmel
Comment 1
2006-10-17 17:58:49 PDT
Created
attachment 11126
[details]
zero pointers in constructor HashTable.h
Michael Emmel
Comment 2
2006-10-17 18:02:50 PDT
Created
attachment 11127
[details]
Missed the second constructor
Maciej Stachowiak
Comment 3
2006-10-17 20:49:44 PDT
I don't think this is necessary because the constructors all call addIterator, which initializes both m_next and m_previous. Will ask for Darin's input.
Michael Emmel
Comment 4
2006-10-17 21:24:39 PDT
Okay the problem is in the assert assert(table->m_iterators != it); it->m_next = table->m_iterators; If their is a problem it triggers before we initalize the m_next so its still garbage and makes it hard to debug. Been a while since I looked at this. The assert could be moved below and still work.
Darin Adler
Comment 5
2006-10-18 11:35:57 PDT
(In reply to
comment #3
)
> I don't think this is necessary because the constructors all call addIterator, > which initializes both m_next and m_previous. Will ask for Darin's input.
Maciej's correct about my original intent.
Michael Emmel
Comment 6
2006-10-18 12:08:45 PDT
Can you move the assert below the setting of the value then ? So the pointer is not garbage when the assert triggers. From this assert(table->m_iterators != it); it->m_next = table->m_iterators; To this //set pointer so its not garbage it->m_next = table->m_iterators; //assert now if its incorrect. assert(table->m_iterators != it); Its not completely obvious the next pointer is garbage if you trigger this in a debugger.
Darin Adler
Comment 7
2006-10-21 18:48:52 PDT
Comment on
attachment 11127
[details]
Missed the second constructor This patch won't compile (missing colon in the second constructor). And I'm not convinced the change is helpful. I understand that this confused you once while debugging, but I'd prefer to just leave this as-is unless you present a more compelling argument to change it.
Michael Emmel
Comment 8
2006-10-22 00:02:38 PDT
I don't think the patch is the right answer in the first place. If you do hit the assert your dealing with some intresting info in a debugger. And it does its job below. I've got no strong feelings either way it was just confusing at the time. The reason I hit it the first time is actually a bit more involved I had compiled JavaScriptCore and WebKit with different debug flags but this is more a build/linking issue. From my experience this does not seem to work.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug