Closed
Bug 199056
Opened 23 years ago
Closed 23 years ago
cookie_FindPosition() uses uninitialized oldestPositionFromHost; max cookies per host can be greater than 20 - Trunk [@ nsCString::~nsCString]
Categories
(Core :: Networking: Cookies, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jrgmorrison, Assigned: dwitte)
References
Details
(Keywords: crash, topcrash)
Crash Data
Attachments
(1 file, 1 obsolete file)
|
3.50 KB,
patch
|
dwitte
:
superreview+
|
Details | Diff | Splinter Review |
0) For a given host, remove all cookies related to that host (e.g., using
a test http server hostname)
1) Set 20 cookies for a host to expire in one year
<script>
window.onload = function () {
for (var i = 0; i < 20; ++i) {
var cookie = "x" + i + "=" + "x" + i + ";" +
"expires=Wednesday, 24-Mar-2004 12:00:00 GMT";
document.cookie = cookie;
}
};
</script>
2) Set 20 more, different cookies for a host to expire in one year
<script>
window.onload = function () {
for (var i = 0; i < 20; ++i) {
var cookie = "y" + i + "=" + "y" + i + ";" +
"expires=Wednesday, 24-Mar-2004 12:00:00 GMT";
document.cookie = cookie;
}
};
</script>
Result: 20 pairs of assertions like below
###!!! ASSERTION: nsVoidArray::ElementAt(index past end array) - note on
bug 96108: 'aIndex < Count()', file
h:/mozilla4/mozilla/xpcom/build/../ds\nsVoidArray.h, line 72
Break: at file h:/mozilla4/mozilla/xpcom/build/../ds\nsVoidArray.h, line 72
###!!! ASSERTION: corrupt cookie list: 'deleteCookie', file
h:/mozilla4/mozilla/extensions/cookie/nsCookies.cpp, line 780
Break: at file h:/mozilla4/mozilla/extensions/cookie/nsCookies.cpp, line
780
3) quit and inspect the cookies.txt file; there are 40 cookies set for the host
The problem is that the variable 'oldestPositionFromHost' in
cookie_FindPosition() is used uninitialized.
| Reporter | ||
Comment 1•23 years ago
|
||
This is wrong, wrong, wrong :-). We should fix this before 1.4a is done.
Flags: blocking1.4a?
| Reporter | ||
Comment 2•23 years ago
|
||
Or, just prepare a single file and run this script to set 40 cookies.
<script>
window.onload = function () {
for (var i = 0; i < 20; ++i) {
var cookie;
cookie = "x" + i + "=" + "x" + i + ";" +
"expires=Wednesday, 24-Mar-2004 12:00:00 GMT";
document.cookie = cookie;
cookie = "y" + i + "=" + "y" + i + ";" +
"expires=Wednesday, 24-Mar-2004 12:00:00 GMT";
document.cookie = cookie;
}
};
</script>
| Assignee | ||
Comment 3•23 years ago
|
||
hmm, yes, this is wrong :)
however, I'm not immediately seeing how this is related to
oldestPositionFromHost begin uninitialized. i'm aware of that warning, and I've
deliberately ignored it because I think it's bogus (it's impossible for it to be
uninitialized if the precondition is satisfied; namely, countFromHost >=
MAX_COOKIES_PER_SERVER).
i'll look into this bug and get in a fix before 1.4a. thanks jrgm!
| Assignee | ||
Comment 4•23 years ago
|
||
*** Bug 198923 has been marked as a duplicate of this bug. ***
| Assignee | ||
Comment 5•23 years ago
|
||
okay, so this really had nothing to do with the uninited variable; that portion
is fine and i'll leave it that way (silly compilers)...
the problem is far more simple and embarassing. someone please r/sr and check
this in before anybody else notices ;)
| Assignee | ||
Comment 6•23 years ago
|
||
Updated•23 years ago
|
Attachment #118436 -
Flags: superreview+
Attachment #118436 -
Flags: review+
| Assignee | ||
Comment 7•23 years ago
|
||
oops, forgot to fix another instance.
so the problem was in the comparison |if (oldestTime >
nsInt64(cookieInList->lastAccessed))| ... oldestTime has to be init'ed to
LL_MAXINT instead of LL_MININT, to ensure that the statement is executed at
least once.
ready for r/sr/checkin
Attachment #118436 -
Attachment is obsolete: true
| Assignee | ||
Comment 8•23 years ago
|
||
Comment on attachment 118440 [details] [diff] [review]
new fix; more context in diff
carrying over sr=heikki
Attachment #118440 -
Flags: superreview+
| Assignee | ||
Comment 9•23 years ago
|
||
checked in by timeless
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
| Reporter | ||
Comment 10•23 years ago
|
||
Actually, the warning was not bogus, and in fact was trying to tell you
something important ;-)
Comment 11•23 years ago
|
||
Adding stack signature and crash, topcrash keywords for future reference (from
duped bug 198923). This problem introduced a topcrasher.
Updated•15 years ago
|
Crash Signature: [@ nsCString::~nsCString]
You need to log in
before you can comment on or make changes to this bug.
Description
•