Quantcast
[open] bug in lua string escape - ESOUI
Thread Tools Display Modes
01/31/21, 12:23 PM   #1
Shinni
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 155
[open] bug in lua string escape

There is a bug when reading escaped strings.
Any string containing the byte sequence 5C 30 B2 is unable to be loaded by the game.
For example when a string contains the byte sequence 00 B2 and is stored in the saved variables, eso stores the string in escaped form and 00 B2 is stored/escaped as 5C 30 B2 (i.e. the 0 byte becomes \0). When the game then tries to read this escaped string, it throws the error "escape sequence too large near '' ".

How to reproduce:
mySavedVarsTable.test = string.char(0,178) -- assign the string consisting of 00 B2
/reloadui -- the game now stores 5C 30 B2 (\0 in the saved variables file because 00 is escaped to 5C 30
You now get a lua error "escape sequence too large near '' "

edit: Besides of 5C 30 B2 this also when replacing B2 by B3 or B9.
B2 = (exponent 2)
B3 = (exponent 3)
B9 = (exponent 1)
No other characters throw this error when preceded by \0 except for these three exponent characters.

edit2:
Since in lua one can escape characters via \decimal (eg \65 for A) I think your unescape algorithm tries to read \0 as a single character like \02 instead of two characters \0 and .

edit3:
Actually, the issue is larger than that. The string 00 32 (0 byte followed by the character 2) is escaped to \02, i.e. \0 and 2.
However, when loading the string it is interpreted as a single character instead of two.

Last edited by Shinni : 01/31/21 at 12:43 PM.
  Reply With Quote
01/31/21, 05:09 PM   #2
Shinni
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 155
I think the easiest fix is to escape the 0 byte to \000. That fixes all the issues mentioned above.
  Reply With Quote

ESOUI » Developer Discussions » Bug Reports » [open] bug in lua string escape

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off