Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57544 Fix potential infinite loop if pos == 0 Only need to update lastValid & pos if bytes have been moved.