Page MenuHomePhabricator

mw.ustring.byteoffset wrong for negative 'i' in LuaSandbox
Closed, ResolvedPublic

Description

From https://en.wikipedia.org/wiki/Wikipedia_talk:Lua#mw.ustring.byteoffset_bug:

Does mw.ustring.byteoffset work correctly with negative offsets? Putting the
following into the debug window gives the values shown:
for i = -1, -5, -1 do print(i, mw.ustring.byteoffset('abcde', 0, i)) end
-1 3
-2 2
-3 1
-4 nil
-5 nil
I don't need the function—I'm just asking if it has a bug. Johnuniq (talk)
02:22, 25 June 2013 (UTC)

Further investigation reveals that the LuaStandalone implementation works correctly, it's only LuaSandbox that has the problem.

Patch to be submitted momentarily.


Version: master
Severity: normal

Details

Reference
bz50176

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:03 AM
bzimport set Reference to bz50176.
Anomie created this task.Jun 25 2013, 2:05 PM

Related URL: https://gerrit.wikimedia.org/r/70421 (Gerrit Change Iceee1022a55abd7a08df1ea7843e1277eb02798b)

Change merged. It will most likely be deployed to WMF wikis along with 1.22wmf9, see https://www.mediawiki.org/wiki/MediaWiki_1.22/Roadmap for the schedule.

Change 95409 had a related patch set uploaded by MarkAHershberger:
Fix LuaSandbox mw.ustring.byteoffset with negative 'i'

https://gerrit.wikimedia.org/r/95409

Change 95409 abandoned by MarkAHershberger:
Fix LuaSandbox mw.ustring.byteoffset with negative 'i'

https://gerrit.wikimedia.org/r/95409

No open patches to review here (backport patches got abandoned), hence resetting status to RESOLVED FIXED. Backport_to_Stable flag might be set to "-" by hexmode.