Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix eqat bounds check for good.
  • Loading branch information
timo committed Oct 9, 2013
1 parent 84eac7b commit e77d5ba
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/vm/parrot/ops/nqp.ops
Expand Up @@ -3748,16 +3748,15 @@ inline op nqp_string_equal_at(out INT, in STR, in STR, in INT) {
}
}

if (($3)->strlen == 1) {
if (($2)->strlen - offset < ($3)->strlen || offset > ($2)->strlen) {
$1 = 0;
} else if (($3)->strlen == 1) {
$1 = (STRING_ord(interp, $3, 0) == STRING_ord(interp, $2, offset));
} else {

if (($2)->encoding == ($3)->encoding) {
STRING_ITER_INIT(interp, &hay_iter);
STRING_iter_skip(interp, $2, &hay_iter, offset);
$1 = memcmp($2->strstart + hay_iter.bytepos, $3->strstart, STRING_byte_length($3)) == 0;
} else if (($2)->strlen - offset < ($3)->strlen || offset > ($2)->strlen) {
$1 = 0;
} else {
done = 0;
$1 = 1;
Expand Down

0 comments on commit e77d5ba

Please sign in to comment.