Skip to content

Commit

Permalink
Avoid a benign std::vector range assertion (fixes #64)
Browse files Browse the repository at this point in the history
The expression `&data[pos]` may assert on certain compilers when `pos` is equal
to the vector size. Since we're fine with getting an "after-last" element
pointer, replace it with a non-asserting expression.
  • Loading branch information
jpcima committed Jul 31, 2022
1 parent 958f61d commit 8077347
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sources/ysfx_preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static void ysfx_parse_preset_from_rpl_blob(ysfx_preset_t *preset, const char *n
}

// whatever follows null is the raw serialization
state.data = const_cast<uint8_t *>(&data[pos]);
state.data = const_cast<uint8_t *>(data.data() + pos);
state.data_size = len - pos;

// parse a line of 64 slider floats (or '-' if missing)
Expand Down

0 comments on commit 8077347

Please sign in to comment.