Skip to content

Commit

Permalink
Serialize byteOffset as size_t, avoiding cast
Browse files Browse the repository at this point in the history
Fixes silently writing an overflowed int in the output file.
  • Loading branch information
emimvi committed Sep 1, 2023
1 parent acf1e8a commit bf7120f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tiny_gltf.h
Original file line number Diff line number Diff line change
Expand Up @@ -7124,7 +7124,7 @@ static void SerializeGltfAccessor(const Accessor &accessor, detail::json &o) {
SerializeNumberProperty<int>("bufferView", accessor.bufferView, o);

if (accessor.byteOffset != 0)
SerializeNumberProperty<int>("byteOffset", int(accessor.byteOffset), o);
SerializeNumberProperty<size_t>("byteOffset", accessor.byteOffset, o);

SerializeNumberProperty<int>("componentType", accessor.componentType, o);
SerializeNumberProperty<size_t>("count", accessor.count, o);
Expand Down

0 comments on commit bf7120f

Please sign in to comment.