Fix conditional check in SkipSpaces function to prevent out-of-bound access.

The `SkipSpaces` function's condition was updated to ensure that the pointer check `in != end` is evaluated before dereferencing the pointer. This change prevents potential out-of-bound access when the input pointer reaches the end.
pull/5770/head
dataisland 2024-09-09 14:25:58 -05:00
parent 4024726eca
commit 5eea2566bc
1 changed files with 1 additions and 1 deletions

View File

@ -103,7 +103,7 @@ AI_FORCE_INLINE bool IsSpaceOrNewLine(char_t in) {
// --------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------
template <class char_t> template <class char_t>
AI_FORCE_INLINE bool SkipSpaces(const char_t *in, const char_t **out, const char_t *end) { AI_FORCE_INLINE bool SkipSpaces(const char_t *in, const char_t **out, const char_t *end) {
while ((*in == (char_t)' ' || *in == (char_t)'\t') && in != end) { while (in != end && (*in == (char_t)' ' || *in == (char_t)'\t')) {
++in; ++in;
} }
*out = in; *out = in;