@@ -555,7 +555,7 @@ static void fill_window(ARTISTState *s, int startx, int starty,
static void draw_line(ARTISTState *s, int x1, int y1, int x2, int y2,
bool update_start, int skip_pix, int max_pix)
{
- struct vram_buffer *buf;
+ struct vram_buffer *buf = &s->vram_buffer[ARTIST_BUFFER_AP];
uint8_t color;
int dx, dy, t, e, x, y, incy, diago, horiz;
bool c1;
@@ -563,6 +563,12 @@ static void draw_line(ARTISTState *s, int x1, int y1, int x2, int y2,
trace_artist_draw_line(x1, y1, x2, y2);
+ if (x1 * y1 >= buf->size || x2 * y2 >= buf->size) {
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "draw_line (%d,%d) (%d,%d)\n", x1, y1, x2, y2);
+ return;
+ }
+
if (update_start) {
s->vram_start = (x2 << 16) | y2;
}
@@ -620,7 +626,6 @@ static void draw_line(ARTISTState *s, int x1, int y1, int x2, int y2,
x = x1;
y = y1;
color = artist_get_color(s);
- buf = &s->vram_buffer[ARTIST_BUFFER_AP];
do {
if (c1) {