Closed
Bug 650522
Opened 14 years ago
Closed 14 years ago
Can not login on Mail.ru and qiwi.ru in Firefox 3.6.17/3.5.19
Categories
(Core :: Networking: Cookies, defect)
Core
Networking: Cookies
Tracking
()
People
(Reporter: unghost, Assigned: ehsan.akhgari)
References
()
Details
(4 keywords)
Attachments
(2 files, 6 obsolete files)
1.12 KB,
patch
|
dwitte
:
review+
|
Details | Diff | Splinter Review |
4.87 KB,
patch
|
dwitte
:
review+
christian
:
approval1.9.2.18+
|
Details | Diff | Splinter Review |
I've got a report that users can not login on Mail.ru and qiwi.ru with 3.5.19 and 3.6.17 builds ( ftp://ftp.mozilla.org/pub/firefox/nightly/3.6.17-candidates/build2/win32/ru/Firefox%20Setup%203.6.17.exe and ftp://ftp.mozilla.org/pub/firefox/nightly/3.5.19-candidates/build1/win32/ru/Firefox%20Setup%203.5.19.exe ). It somehow connected with changes in cookies handling in these builds.
I verified that with Firefox 3.6.17 candidate build I cannot login on Mail.ru web-interface. It works in Firefox 3.6.16.
I've looked at logs and found only one changeset that change something about cookies - http://hg.mozilla.org/releases/mozilla-1.9.1/rev/2b48d65b67c9
Mail.ru is largest e-mail provider in Russia (more than 50 millions visitor per month). IMHO this should block.
If someone needs test account in Mail.ru, I will be happy to provide one.
![]() |
||
Comment 1•14 years ago
|
||
Reproduced with:
Mozilla/5.0 (X11; U; Linux i686 (x86_64); ru; rv:1.9.2.17) Gecko/20110414 Firefox/3.6.17
WFM with:
Mozilla/5.0 (X11; U; Linux i686 (x86_64); ru; rv:1.9.2.14) Gecko/20110218 Firefox/3.6.14
Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
![]() |
||
Comment 2•14 years ago
|
||
(In reply to comment #1)
> Reproduced with:
(on mail.ru)
Reporter | ||
Comment 3•14 years ago
|
||
ftp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2011-03-30-03-mozilla-1.9.2/firefox-3.6.17pre.en-US.linux-i686.tar.bz2 - works
ftp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2011-04-02-03-mozilla-1.9.2/firefox-3.6.17pre.en-US.linux-i686.tar.bz2 - fails
Regression range - http://hg.mozilla.org/releases/mozilla-1.9.2/pushloghtml?fromchange=59e645275feb&tochange=5db56d0cfa3b
Reporter | ||
Comment 4•14 years ago
|
||
ftp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2011-03-31-03-mozilla-1.9.2/firefox-3.6.17pre.en-US.linux-i686.tar.bz2 - works
ftp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2011-04-01-03-mozilla-1.9.2/firefox-3.6.17pre.en-US.linux-i686.tar.bz2 - fails
Regression range - http://hg.mozilla.org/releases/mozilla-1.9.2/pushloghtml?fromchange=33488621d2a4&tochange=a0c692da4524
Reporter | ||
Updated•14 years ago
|
Keywords: regression,
top100
Assignee | ||
Comment 5•14 years ago
|
||
:(
Posting about this to release-drivers.
Assignee | ||
Comment 6•14 years ago
|
||
Alexander: could you please email me the info for a test account on mail.ru?
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → ehsan
Assignee | ||
Updated•14 years ago
|
Blocks: CVE-2011-2362
Reporter | ||
Comment 7•14 years ago
|
||
(In reply to comment #6)
> Alexander: could you please email me the info for a test account on mail.ru?
Sent.
Comment 8•14 years ago
|
||
Firefox 4.0 works on mail.ru? It contains a fix for the same bug which is why we thought it was safe, but maybe the branch version has a specific problem.
Reporter | ||
Comment 9•14 years ago
|
||
(In reply to comment #8)
> Firefox 4.0 works on mail.ru? It contains a fix for the same bug which is why
> we thought it was safe, but maybe the branch version has a specific problem.
According to comment 1 it works on 4.0.1.
Reporter | ||
Comment 10•14 years ago
|
||
Assignee | ||
Comment 11•14 years ago
|
||
(In reply to comment #8)
> Firefox 4.0 works on mail.ru? It contains a fix for the same bug which is why
> we thought it was safe, but maybe the branch version has a specific problem.
The mozilla-central patch and the branch patches were totally different. This is only a problem on stable branches. I'm trying to figure out why...
Assignee | ||
Comment 12•14 years ago
|
||
So, I have a seemingly safe fix at hand, which I'll attach shortly.
Daniel recommends us that for 1.9.2.17 and 1.9.1.19, we should probably just back out bug 616264, and try to get it in the next time, along with this fix. I'll do the necessary backouts.
Assignee | ||
Comment 13•14 years ago
|
||
Attachment #526830 -
Flags: review?(dwitte)
Assignee | ||
Comment 14•14 years ago
|
||
Actually, it's best to add the correct length checking too, to make sure that nextDot[1] is not past our string buffer.
Attachment #526830 -
Attachment is obsolete: true
Attachment #526830 -
Flags: review?(dwitte)
Attachment #526842 -
Flags: review?(dwitte)
Assignee | ||
Comment 15•14 years ago
|
||
Mostly the same as the 1.9.2 patch, but applying on 1.9.1, and also making sure that the test passes (since NetUtils doesn't exist on 1.9.1).
Attachment #526843 -
Flags: review?(dwitte)
Assignee | ||
Comment 16•14 years ago
|
||
This can block the next dot-release.
blocking1.9.1: .19+ → ?
blocking1.9.2: .17+ → ?
Assignee | ||
Comment 17•14 years ago
|
||
The lesson that trunk can take from this is the test case, I guess (since this bug doesn't exist on trunk).
Attachment #526847 -
Flags: review?(dwitte)
Comment 18•14 years ago
|
||
I assume we're planning on rebuilding 1.9.2, at least, for this.
Assignee | ||
Comment 19•14 years ago
|
||
(In reply to comment #18)
> I assume we're planning on rebuilding 1.9.2, at least, for this.
Christian told me that we are, yes. I've landed the backouts earlier today, FWIW.
Comment 20•14 years ago
|
||
Comment on attachment 526842 [details] [diff] [review]
1.9.2 patch
Is
(nextDot < end && *(nextDot + 1) == '\0')
required in the conditional check?
This evaluates true if the character after a '.' is '\0' or the second character after the initial '.' is '\0'. For the former case, I believe strchr() handles it, due to returning NULL after not finding '.' .
The latter only applies in the first iteration of the loop. There shouldn't be a problem if the string is something like ".\0." since *currentDot will evaluate to FALSE in the ?: . There is a small difference in that the loop iterates one more time with nextDot = nsnull.
Comment 21•14 years ago
|
||
I see you landed this on 1.9.1 as well, Dan.
Comment 22•14 years ago
|
||
I confirm this bug with firefox-3.6.17 (linux)
Assignee | ||
Comment 23•14 years ago
|
||
(In reply to comment #20)
> Comment on attachment 526842 [details] [diff] [review]
> --> https://bugzilla.mozilla.org/attachment.cgi?id=526842
> 1.9.2 patch
>
> Is
> (nextDot < end && *(nextDot + 1) == '\0')
> required in the conditional check?
>
> This evaluates true if the character after a '.' is '\0' or the second
> character after the initial '.' is '\0'. For the former case, I believe
> strchr() handles it, due to returning NULL after not finding '.' .
I added |nextDot < end| because otherwise *(nextDot+1) could read memory not part of the string. What this check effectively tests is whether there is a null character after nextDot.
Comment 24•14 years ago
|
||
(In reply to comment #23)
> (In reply to comment #20)
> > Comment on attachment 526842 [details] [diff] [review]
>
> I added |nextDot < end| because otherwise *(nextDot+1) could read memory not
> part of the string. What this check effectively tests is whether there is a
> null character after nextDot.
Thanks for the clarification
Assignee | ||
Comment 25•14 years ago
|
||
David pinged me about this on IRC, which caused me to document why I added the length checks in these patches.
Originally I ported the first version of the patch (without the |nextDot < end| checks) to 1.9.1, and I saw an existing test under extensions/cookie failing. I investigated that under the debugger, and the values of currentDot and nextDot were in such a way that made this length check necessary. I don't remember the exact details at all, and unfortunately I don't have my 1.9.{1,2} object directories around any more, but if you're curious, you can follow my footsteps as I laid out here and see what was breaking under 1.9.1, which caused me to add the length checks.
Assignee | ||
Comment 26•14 years ago
|
||
(In reply to comment #25)
> David pinged me about this on IRC, which caused me to document why I added the
> length checks in these patches.
And here's the rest of the story, courtesy of David!
dchan
grr curiosity got the best of me
dchan
looking at 1.9.1 code
ehsan
heh
dchan
there appears to be a path for fileURIs
dchan
where an empty host can get by
ehsan
this rings a bell
ehsan
yeah, maybe it was a file URI
dchan
then you insert . in front
dchan
currentDot = '.'
dchan
nextDot = '\0'
dchan
nextDot + 1 off the string
ehsan
yes
ehsan
which would fail http://mxr.mozilla.org/mozilla1.9.1/source/extensions/cookie/test/unit/test_bug526789.js#65
ehsan
:)
Comment 27•14 years ago
|
||
blocking 1.9.2/1.9.1 per comment 19, and fixed by backout of bug 616264
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/1a8da3d914c3 (default)
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/fab6db5c327d (relbranch)
http://hg.mozilla.org/releases/mozilla-1.9.1/rev/9e0d3f6ee9af (default)
http://hg.mozilla.org/releases/mozilla-1.9.1/rev/b2756532de0f (relbranch)
This regression bug is "fixed". It would be best to track the "fix bug 616264 correctly" patch in that other bug since that's not how we're fixing the regression. If for some reason you need new patches we can put those in the other bug, otherwise no need to duplicate them.
Status: NEW → RESOLVED
blocking1.9.1: ? → .19+
blocking1.9.2: ? → .17+
Closed: 14 years ago
status1.9.1:
--- → .19-fixed
status1.9.2:
--- → .17-fixed
Resolution: --- → FIXED
Assignee | ||
Comment 28•14 years ago
|
||
(In reply to comment #27)
> This regression bug is "fixed". It would be best to track the "fix bug 616264
> correctly" patch in that other bug since that's not how we're fixing the
> regression. If for some reason you need new patches we can put those in the
> other bug, otherwise no need to duplicate them.
I'll keep my patches in this bug, and will just apply them on top of the patches in bug 616264 when they get reviewed. This will make Dan's job as the reviewer much easier.
Comment 29•14 years ago
|
||
I've verified this fix in build 2 of 1.9.1.19 and build 3 of 1.9.2.17 (and against earlier builds) using a mail.ru account that I created for myself.
Keywords: verified1.9.1,
verified1.9.2
Assignee | ||
Comment 30•14 years ago
|
||
Dan: ping?
Comment 31•14 years ago
|
||
Pong. :( I'll take a look at this on Sunday!
Comment 32•14 years ago
|
||
Comment on attachment 526847 [details] [diff] [review]
Trunk patch (test only)
r=dwitte
Attachment #526847 -
Flags: review?(dwitte) → review+
Comment 33•14 years ago
|
||
Comment on attachment 526842 [details] [diff] [review]
1.9.2 patch
>diff --git a/netwerk/cookie/src/nsCookieService.cpp b/netwerk/cookie/src/nsCookieService.cpp
>--- a/netwerk/cookie/src/nsCookieService.cpp
>+++ b/netwerk/cookie/src/nsCookieService.cpp
>@@ -1284,16 +1284,17 @@ nsCookieService::GetCookieInternal(nsIUR
> const char *currentDot = hostFromURI.get();
> const char *nextDot = currentDot + 1;
>+ const char *end = currentDot + (hostFromURI.Length() - 1);
So for a string 'foo', 'end' now points to the last character 'o'...
>@@ -1338,17 +1339,17 @@ nsCookieService::GetCookieInternal(nsIUR
>- if (!nextDot || *(nextDot + 1) == '.')
>+ if (!nextDot || (nextDot < end && *(nextDot + 1) == '\0'))
> break;
Which means the test 'nextDot < end && *(nextDot + 1) == '\0'' will never evaluate true.
I think you either want 'end' to be pointing to the null, or use an '<=' test here? Since the intent of this test is to break out if there's a '.' at the end of the string; but not if 'nextDot' actually is the end of the string, which happens for file:// URIs.
Does that sound right?
Assignee | ||
Comment 34•14 years ago
|
||
Yes, that makes sense. I'll submit new patches in a moment. Sorry for my delay.
Assignee | ||
Comment 35•14 years ago
|
||
Attachment #526842 -
Attachment is obsolete: true
Attachment #526842 -
Flags: review?(dwitte)
Attachment #537679 -
Flags: review?(dwitte)
Assignee | ||
Comment 36•14 years ago
|
||
Attachment #526843 -
Attachment is obsolete: true
Attachment #526843 -
Flags: review?(dwitte)
Attachment #537680 -
Flags: review?(dwitte)
Assignee | ||
Comment 37•14 years ago
|
||
This time it's the right patch!
Attachment #537679 -
Attachment is obsolete: true
Attachment #537679 -
Flags: review?(dwitte)
Attachment #537681 -
Flags: review?(dwitte)
Assignee | ||
Updated•14 years ago
|
Attachment #537681 -
Flags: approval1.9.2.18?
Assignee | ||
Comment 38•14 years ago
|
||
Comment on attachment 537680 [details] [diff] [review]
1.9.1 patch
So long, 1.9.1! You were a cute little stable branch. Your memory will stay with us.
Attachment #537680 -
Attachment is obsolete: true
Attachment #537680 -
Flags: review?(dwitte)
Assignee | ||
Comment 39•14 years ago
|
||
Trunk test case pushed to cedar: http://hg.mozilla.org/projects/cedar/rev/53abbc401888
Assignee | ||
Comment 40•14 years ago
|
||
Without the unnecessary cruft.
Attachment #537686 -
Flags: review?(dwitte)
Attachment #537686 -
Flags: approval1.9.2.18?
Assignee | ||
Updated•14 years ago
|
Attachment #537681 -
Attachment is obsolete: true
Attachment #537681 -
Flags: review?(dwitte)
Attachment #537681 -
Flags: approval1.9.2.18?
Comment 41•14 years ago
|
||
Comment on attachment 537686 [details] [diff] [review]
1.9.2 patch
Review of attachment 537686 [details] [diff] [review]:
-----------------------------------------------------------------
Ship it!
Attachment #537686 -
Flags: review?(dwitte) → review+
Attachment #537686 -
Flags: approval1.9.2.18? → approval1.9.2.18+
Assignee | ||
Comment 42•14 years ago
|
||
Landed for 1.9.2.18:
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/bb935ffe5ff1
Comment 43•14 years ago
|
||
Test case in m-c:
http://hg.mozilla.org/mozilla-central/rev/53abbc401888
Flags: in-testsuite+
Updated•14 years ago
|
blocking1.9.2: .17+ → .18+
You need to log in
before you can comment on or make changes to this bug.
Description
•