Open Bug 619166 Opened 10 years ago Updated 11 months ago

Make all string control character sanitization handle invalid characters as well

Categories

(Camino Graveyard :: General, defect)

All
macOS
defect
Not set
normal

Tracking

(Not tracked)

People

(Reporter: alqahira, Unassigned)

Details

(Keywords: good-first-bug)

I noticed last night that the fancy location-bar sanitizing code, BWC's |cleanPastedText:|, cleans not only control characters, but also invalid characters.

All of our uses of |stringByReplacingCharactersInSet:withString:| to sanitize (save the one in CHStringBundleOverride, which is doing something else entirely, and arguably is not sanitizing in the way we use sanitizing elsewhere) only clean control characters.

If we care enough to strip invalid characters in some places (BWC's callers of |cleanPastedText:|, which prior to bug 411165 just stripped control characters), it seems to me like we ought to care in all other places where we strip control characters.

I think we should consider uplifting the NSCharacterSet part (or at least the illegalAndControlCharacterSet-creation part of the NSCharacterSet part) of |cleanPastedText:| to some common place and then converting all other |stringByReplacingCharactersInSet:[NSCharacterSet controlCharacterSet]| callers to |stringByReplacingCharactersInSet:[NSCharacterSet illegalAndControlCharacterSet]|.
I and Wevah both agree we should do this.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [good first bug]
Keywords: good-first-bug
Whiteboard: [good first bug]
You need to log in before you can comment on or make changes to this bug.