[NTOSKRNL] Do not try to access OldBackTracking[-1]

It can be triggered by the existing "F<", "FILE.TXT" case in the tests.

CORE-15902
This commit is contained in:
Bartosz Brachaczek 2019-04-01 02:09:23 +02:00 committed by Pierre Schweitzer
parent 695e00fbbd
commit d256ff6006
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B

View file

@ -248,7 +248,7 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression,
if (NamePosition >= Name->Length)
{
EndOfName = TRUE;
if (OldBackTracking[MatchingChars - 1] == Expression->Length * 2)
if (MatchingChars && OldBackTracking[MatchingChars - 1] == Expression->Length * 2)
break;
}
else
@ -422,7 +422,7 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression,
}
/* Store result value */
Result = (OldBackTracking[MatchingChars - 1] == Expression->Length * 2);
Result = MatchingChars && (OldBackTracking[MatchingChars - 1] == Expression->Length * 2);
Exit: