orca-app / orca

A Wasm environment for cross-platform, sandboxed graphical applications.
https://orca-app.dev
Other
156 stars 13 forks source link

Fix buffer copySize calculation in oc_gl_canvas_encode_path #39

Closed bitwitch closed 9 months ago

bitwitch commented 9 months ago

This patch fixes what seems like a copy-paste error that was causing crashes when drawing a large number of images. The calculation of copySize in oc_gl_canvas_encode_path(), which is the third parameter passed to oc_gl_grow_input_buffer(), was using eltCount instead of the intended pathCount. I fixed this and also added some guards in both of the encode functions to ensure that a newly calculated buffer capacity is always greater than eltCount or pathCount.

martinfouilleul commented 9 months ago

Ah yes, good catch (both for the copy/paste and the oversight regarding the new buffer capacity). Thanks for the PR!