Skip to content

Commit 0a424cb

Browse files
committed
Merge remote-tracking branch 'origin/asar_2_beta' into asar_2_beta
2 parents 158d55a + dea2285 commit 0a424cb

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/asar/libstr.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ bool readfile(const char * fname, const char * basepath, char ** data, int * len
8585
#define isq(n) (((0x2227 ^ (0x0101 * (n))) - 0x0101UL) & ~(0x2227 ^ (0x0101 * (n))) & 0x8080UL)
8686
#define isqp(n) (((0x22272829 ^ (0x01010101 * (n))) - 0x01010101UL) & ~(0x22272829 ^ (0x01010101 * (n))) & 0x80808080UL)
8787

88-
const bool qparlut[256] = {
88+
// RPG Hacker: Only index this with ASCII characters.
89+
// Anything else doesn't make sense, anyways.
90+
const bool qparlut[128] = {
8991
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9092
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9193
0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
@@ -94,14 +96,6 @@ const bool qparlut[256] = {
9496
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9597
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9698
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
97-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
98-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
100-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
101-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
102-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
103-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
104-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
10599
};
106100

107101
//this will leave the last char found as the one pointed at
@@ -261,7 +255,7 @@ bool confirmqpar(const char * str)
261255
{
262256
//todo fully optimize
263257
int par = 0;
264-
while(!qparlut[*str]) str++;
258+
while((unsigned char)*str >= 128 || !qparlut[*str]) str++;
265259
while(*str)
266260
{
267261
if(*str == '"')
@@ -281,7 +275,7 @@ bool confirmqpar(const char * str)
281275
par += 1 - ((*str++ - '(') << 1);
282276
if(par < 0) return false;
283277
}
284-
while(!qparlut[*str]) str++;
278+
while((unsigned char)*str >= 128 || !qparlut[*str]) str++;
285279
}
286280
return !par;
287281
}

0 commit comments

Comments
 (0)