https://bugzilla.wikimedia.org/show_bug.cgi?id=22967

--- Comment #21 from Arod Shatil <[email protected]> 2010-05-30 17:16:22 
UTC ---
(In reply to comment #20)
> Fixed in r66913
unfortunately this fix has an off-by-one bug:
+        if (len > 250) {
+            if (e.preventDefault) e.preventDefault();
+            e.returnValue = false; //IE
+            return false;
+        }

this means that if len *is* 250 (or 249 for that matter) the script will allow
you to add one more character, which can be 2 or 3 extra bytes which will get
truncated.
we need to do one of the following:
-- concatenate the "event.data" to summary.value before calculating the length,
thus:
+        len = (summary.value +
event.data).replace(/[\u0080-\u07FF\uD800-\uDFFF]/g,
'**').replace(/[\u0800-\uD7FF\uE000-\uFFFF]/g, '***').length;
-- use 247 instead of 250 for the comparison

peace.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to