Closed Bug 1943846 Opened 1 year ago Closed 1 year ago

In-page search may incorrectly behave for characters with Unicode code points greater than U+10000

Categories

(Toolkit :: Find Toolbar, defect)

Firefox 136
Desktop
All
defect

Tracking

()

RESOLVED FIXED
137 Branch
Tracking Status
firefox137 --- fixed

People

(Reporter: tjj.rikap, Assigned: tjj.rikap)

Details

Attachments

(2 files)

Attached image Screenshot

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:134.0) Gecko/20100101 Firefox/134.0

Steps to reproduce:

Search a character in page of which the Unicode point is U+x00yy where:

  • x >= 1
  • yy is 09, 0A, 0D or 20.

Here are some of the characters may be used:
[𐀉] [𠀍] [􀀉] [𰀠]

Actual results:

All spaces in page will be matched. These characters also will match each other.

Tested on Linux Firefox 134, 136-nightly, and Windows Firefox.

Expected results:

Only these specific characters will be matched.

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core
Component: Widget: Gtk → Search
OS: Unspecified → All
Product: Core → Firefox
Hardware: Unspecified → Desktop
Component: Search → Find Toolbar
Product: Firefox → Toolkit

I'm trying to fix it! If anyone has progress please share it here!

I think I've fixed it! Could anyone kindly assign it to me and review my patch?

Flags: needinfo?(enndeakin)

You will automatically be assigned to the bug after submitting the patch.

Flags: needinfo?(enndeakin)

The original IsSpace macro uses nsCRT::IsAsciiSpace which doesn't handle
UTF-32 characters (characters above U+FFFF) correctly. Add a check for UTF-32
characters to ensure correct matching behavior. Also add a test case to
test_nsFind.html to verify the fix for Bug 1943846.

Assignee: nobody → tjj.rikap
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9463306 - Flags: approval-mozilla-beta?
Attachment #9463306 - Flags: approval-mozilla-beta?
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e1882c174191 Fix nsFind::IsSpace to handle UTF-32 characters correctly. r=emilio
Attachment #9463306 - Attachment description: Bug 1943846 - Fix nsFind::IsSpace to handle UTF-32 characters correctly. r=emilio → Bug 1943846 - Fix nsFind::IsSpace to handle UTF-32 characters correctly. r=emilio,abutkovits

Ni?ing to run this through all tests.

Flags: needinfo?(emilio)
Attachment #9463306 - Attachment description: Bug 1943846 - Fix nsFind::IsSpace to handle UTF-32 characters correctly. r=emilio,abutkovits → Bug 1943846 - Fix nsFind::IsSpace to handle UTF-32 characters correctly. r=emilio
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b71c8c052463 Fix nsFind::IsSpace to handle UTF-32 characters correctly. r=emilio
Backout by agoloman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fc959685b9d9 Backed out changeset b71c8c052463 for causing mass failures. CLOSED TREE

Backed out for causing android mass failures.

Flags: needinfo?(tjj.rikap)

I'm sorry but I have no idea about this error... I think I need help.

Flags: needinfo?(tjj.rikap)

Yeah, can look into it... Maybe some code is choking on the characters on the test or something? But shouldn't really be the case.

Flags: needinfo?(emilio)

Can it be an occasion? I downloaded the target.crashreporter-symbols.zip and it validates well...

Yeah I suspect it was some infra fluke. I pushed this to try to check tho. https://treeherder.mozilla.org/jobs?repo=try&revision=733705b4546b315b4059396fcc0c12ff411b7e7f

Yeah seems good now, will re-queue.

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/832cb4dc696a Fix nsFind::IsSpace to handle UTF-32 characters correctly. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 137 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: