Merge pull request #73068 from dsnopek/webxr-bounds-geometry-bug

Fix byte packing (and buffer overrun) in godot_webxr_get_bounds_geometry()
This commit is contained in:
Rémi Verschelde 2023-02-11 14:35:29 +01:00
commit 7725a1a14c
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -584,12 +584,11 @@ const GodotWebXR = {
}
const buf = GodotRuntime.malloc(point_count * 3 * 4);
GodotRuntime.setHeapValue(buf, point_count, 'i32');
for (let i = 0; i < point_count; i++) {
const point = GodotWebXR.space.boundsGeometry[i];
GodotRuntime.setHeapValue(buf + ((i * 3) + 1) * 4, point.x, 'float');
GodotRuntime.setHeapValue(buf + ((i * 3) + 2) * 4, point.y, 'float');
GodotRuntime.setHeapValue(buf + ((i * 3) + 3) * 4, point.z, 'float');
GodotRuntime.setHeapValue(buf + ((i * 3) + 0) * 4, point.x, 'float');
GodotRuntime.setHeapValue(buf + ((i * 3) + 1) * 4, point.y, 'float');
GodotRuntime.setHeapValue(buf + ((i * 3) + 2) * 4, point.z, 'float');
}
GodotRuntime.setHeapValue(r_points, buf, 'i32');