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)

defect
Not set
blocker

Tracking

()

RESOLVED FIXED
Tracking Status
blocking1.9.2 --- .18+
status1.9.2 --- .18-fixed
blocking1.9.1 --- .19+
status1.9.1 --- .19-fixed

People

(Reporter: unghost, Assigned: ehsan.akhgari)

References

()

Details

(4 keywords)

Attachments

(2 files, 6 obsolete files)

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.
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
(In reply to comment #1) > Reproduced with: (on mail.ru)
Keywords: regression, top100
:( Posting about this to release-drivers.
Alexander: could you please email me the info for a test account on mail.ru?
Assignee: nobody → ehsan
(In reply to comment #6) > Alexander: could you please email me the info for a test account on mail.ru? Sent.
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.
blocking1.9.1: ? → .19+
blocking1.9.2: ? → .17+
(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.
(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...
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.
Attached patch 1.9.2 patch (obsolete) — Splinter Review
Attachment #526830 - Flags: review?(dwitte)
Attached patch 1.9.2 patch (obsolete) — Splinter Review
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)
Attached patch 1.9.1 patch (obsolete) — Splinter Review
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)
This can block the next dot-release.
blocking1.9.1: .19+ → ?
blocking1.9.2: .17+ → ?
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)
I assume we're planning on rebuilding 1.9.2, at least, for this.
(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 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.
I see you landed this on 1.9.1 as well, Dan.
I confirm this bug with firefox-3.6.17 (linux)
(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.
(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
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.
(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 :)
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
Resolution: --- → FIXED
(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.
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.
Dan: ping?
Pong. :( I'll take a look at this on Sunday!
Comment on attachment 526847 [details] [diff] [review] Trunk patch (test only) r=dwitte
Attachment #526847 - Flags: review?(dwitte) → review+
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?
Yes, that makes sense. I'll submit new patches in a moment. Sorry for my delay.
Attached patch 1.9.2 patch (obsolete) — Splinter Review
Attachment #526842 - Attachment is obsolete: true
Attachment #526842 - Flags: review?(dwitte)
Attachment #537679 - Flags: review?(dwitte)
Attached patch 1.9.1 patch (obsolete) — Splinter Review
Attachment #526843 - Attachment is obsolete: true
Attachment #526843 - Flags: review?(dwitte)
Attachment #537680 - Flags: review?(dwitte)
Attached patch 1.9.2 patch (obsolete) — Splinter Review
This time it's the right patch!
Attachment #537679 - Attachment is obsolete: true
Attachment #537679 - Flags: review?(dwitte)
Attachment #537681 - Flags: review?(dwitte)
Attachment #537681 - Flags: approval1.9.2.18?
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)
Attached patch 1.9.2 patchSplinter Review
Without the unnecessary cruft.
Attachment #537686 - Flags: review?(dwitte)
Attachment #537686 - Flags: approval1.9.2.18?
Attachment #537681 - Attachment is obsolete: true
Attachment #537681 - Flags: review?(dwitte)
Attachment #537681 - Flags: approval1.9.2.18?
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+
blocking1.9.2: .17+ → .18+
Depends on: 667087
No longer depends on: 667087
Depends on: 667087
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: