From a9f8f178a107b8d411adfc519db4c0fa7e492668 Mon Sep 17 00:00:00 2001 From: otya128 Date: Sat, 31 Dec 2016 21:55:11 +0900 Subject: [PATCH] Add BGPUT argument check --- SMILEBASIC/builtinfunctions.d | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SMILEBASIC/builtinfunctions.d b/SMILEBASIC/builtinfunctions.d index d510c76..2ea2b42 100644 --- a/SMILEBASIC/builtinfunctions.d +++ b/SMILEBASIC/builtinfunctions.d @@ -2360,6 +2360,14 @@ class BuiltinFunction { throw new OutOfRange("BGPUT", 1); } + if (x < 0 || x >= p.getBG(layer).width) + { + throw new OutOfRange("BGPUT", 2); + } + if (y < 0 || y >= p.getBG(layer).height) + { + throw new OutOfRange("BGPUT", 3); + } p.getBG(layer).put(x, y, screendata); } static void BGHOME(PetitComputer p, int layer, int x, int y)