fixed a bug in LuaJ's string.match. hopefully. closes #138

This commit is contained in:
Florian Nücke 2014-02-26 01:13:53 +01:00
parent 55a90f8b63
commit 6f8bb90f24

View File

@ -1155,7 +1155,7 @@ public class StringLib extends TwoArgFunction {
if ( poff == plen || poff + 1 == plen ) {
error( "unbalanced pattern" );
}
if ( s.luaByte( soff ) != p.luaByte( poff ) )
if ( soff >= s.length() || s.luaByte( soff ) != p.luaByte( poff ) )
return -1;
else {
int b = p.luaByte( poff );