From 3e7989891b1e8d9c70177175003e85a10988bc24 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Tue, 18 Jan 2011 03:33:38 +0100 Subject: [PATCH] Fix out of bounds access for empty frames This was causing broken float values (NaN) which kill the output processor. --- libol/libol.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libol/libol.c b/libol/libol.c index b755b14..eb2385c 100644 --- a/libol/libol.c +++ b/libol/libol.c @@ -835,8 +835,13 @@ float olRenderFrame(int max_fps) last_info.resampled_points = count; } - float last_x = frames[cwbuf].points[count-1].x; - float last_y = frames[cwbuf].points[count-1].y; + float last_x, last_y; + if (count) { + last_x = frames[cwbuf].points[count-1].x; + last_y = frames[cwbuf].points[count-1].y; + } else { + last_x = last_y = 0; + } while(count < min_points) { frames[cwbuf].points[count].x = last_x; frames[cwbuf].points[count].y = last_y; -- 2.52.0