Skip to content

Commit 9d0a7ff

Browse files
committed
Fix access violation problem on high color mode (#116), Thanks to SuhwanSong
1 parent 88ca20b commit 9d0a7ff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/tosixel.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ sixel_encode_highcolor(
14191419
goto end;
14201420
}
14211421
}
1422-
if (dirty && mod_y == 5) {
1422+
if (dirty && (mod_y == 5 || y >= height)) {
14231423
orig_height = height;
14241424

14251425
if (output_count++ == 0) {
@@ -1442,6 +1442,9 @@ sixel_encode_highcolor(
14421442
if (SIXEL_FAILED(status)) {
14431443
goto error;
14441444
}
1445+
if (y >= orig_height) {
1446+
goto end;
1447+
}
14451448
pixels -= (6 * width * 3);
14461449
height = orig_height - height + 6;
14471450
goto next;
@@ -1452,6 +1455,7 @@ sixel_encode_highcolor(
14521455
mod_y = 0;
14531456
}
14541457
}
1458+
14551459
goto next;
14561460

14571461
end:

0 commit comments

Comments
 (0)