anchor.diff:    State:=WorkQueueToCachedState(WorkQueues[0],Flags);
     StartState^:=State;
    end;
  - for Position:=StartPosition to UntilExcludingPosition-1 do begin
  + for Position:=StartPosition to UntilExcludingPosition{-1} do begin // No -1 because match can be delayed of one byte
     LastState:=State;
  -  State:=State^.NextStates[LocalByteMap[byte(ansichar(LocalInput[Position]))]];
  +  if Position<LocalInputLength then begin
  +   CurrentChar:=byte(ansichar(LocalInput[Position]));
  +  end else begin
  +   CurrentChar:=256;
  +  end;
  +  State:=State^.NextStates[LocalByteMap[CurrentChar]];
     if not assigned(State) then begin
  -   State:=RunStateOnByte(LastState,Position,byte(ansichar(LocalInput[Position])),false);
  +   State:=RunStateOnByte(LastState,Position,CurrentChar,false);
      if not assigned(State) then begin
       result:=DFAError;
       exit;
  
positive.code:  AfterFlags:=0;
  
   // Calculate flags
   if CurrentChar<>$ffffffff then begin
    if (rfUTF8 in Instance.Flags) and (CurrentChar>=$80) then begin
     UnicodeChar:=UTF8PtrCodeUnitGetCharFallback(ThreadLocalStorageInstance.Input,ThreadLocalStorageInstance.InputLength,Position);
     case UnicodeChar of
  
negative.code:   StatePoolUsed:=nil;
    StatePoolFree:=nil;
  
    NextStatesSize:=(Instance.ByteMapCount+1)*sizeof(PFLREDFAState);
    StateSize:=ptrint(ptruint(pointer(@FLREDFAStateCreateTempDFAState.NextStates))-ptruint(pointer(@FLREDFAStateCreateTempDFAState)))+NextStatesSize;
  
    StatePoolSize:=(65536 div StateSize)*StateSize;
  