From ee42c2a443db8425b20bf795adb93aa9306b4a96 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Sat, 7 Oct 2023 16:37:08 -0300 Subject: [PATCH] Add missing `JS_ToBool()` error handling --- source/canvas.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/canvas.c b/source/canvas.c index 3b1515c3..10670bc7 100644 --- a/source/canvas.c +++ b/source/canvas.c @@ -315,6 +315,8 @@ static JSValue js_canvas_arc(JSContext *ctx, JSValueConst this_val, int argc, JS } int counterclockwise = JS_ToBool(ctx, argv[6]); + if (counterclockwise == -1) + return JS_EXCEPTION; cairo_t *cr = context->ctx; @@ -472,6 +474,8 @@ static JSValue js_canvas_ellipse(JSContext *ctx, JSValueConst this_val, int argc double startAngle = args[5]; double endAngle = args[6]; int anticlockwise = JS_ToBool(ctx, argv[8]); + if (anticlockwise == -1) + return JS_EXCEPTION; cairo_t *cr = context->ctx; @@ -1193,6 +1197,9 @@ static JSValue js_canvas_draw_image(JSContext *ctx, JSValueConst this_val, int a cairo_surface_t *surface; int is_canvas = JS_ToBool(ctx, argv[12]); + if (is_canvas == -1) + return JS_EXCEPTION; + if (is_canvas) { // Canvas