Skip to content

Commit cbecbcc

Browse files
committed
Check bounds before checking input type in TRegexSearchNode
1 parent 79c6da6 commit cbecbcc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/SREModuleBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,6 @@ protected Object doCached(VirtualFrame frame, Object pattern, Object input, Obje
649649
@Cached("create(method.getMethodName())") GetAttributeNode getFallbackMethodNode,
650650
@Cached @Shared TRegexCallExec tRegexCallExec,
651651
@Cached @Shared CreateMatchFromTRegexResultNode createMatchFromTRegexResultNode) {
652-
reCheckInputTypeNode.execute(frame, input, tRegexCache.isBinary());
653-
654652
int pos = asSizeNode.executeExact(frame, indexNode.execute(frame, posArg));
655653
int endPos = asSizeNode.executeExact(frame, indexNode.execute(frame, endPosArg));
656654
int length = lengthNode.execute(frame, input);
@@ -665,6 +663,8 @@ protected Object doCached(VirtualFrame frame, Object pattern, Object input, Obje
665663
endPos = length;
666664
}
667665

666+
reCheckInputTypeNode.execute(frame, input, tRegexCache.isBinary());
667+
668668
if (fallbackProfile.profile(inliningTarget, libCompiledRegex.isNull(compiledRegex))) {
669669
Object fallbackRegex = getCallFallbackCompileNode().execute(getGetFallbackCompileNode().executeObject(frame, pattern));
670670
return getCallFallbackMethodNode().execute(getFallbackMethodNode.executeObject(frame, fallbackRegex), input, pos, endPos);

0 commit comments

Comments
 (0)