Skip to content

Commit

Permalink
Fix access violation problem on high color mode (#116), Thanks to Suh…
Browse files Browse the repository at this point in the history
…wanSong
  • Loading branch information
saitoha committed Dec 16, 2019
1 parent 88ca20b commit 9d0a7ff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tosixel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ sixel_encode_highcolor(
goto end;
}
}
if (dirty && mod_y == 5) {
if (dirty && (mod_y == 5 || y >= height)) {
orig_height = height;

if (output_count++ == 0) {
Expand All @@ -1442,6 +1442,9 @@ sixel_encode_highcolor(
if (SIXEL_FAILED(status)) {
goto error;
}
if (y >= orig_height) {
goto end;
}
pixels -= (6 * width * 3);
height = orig_height - height + 6;
goto next;
Expand All @@ -1452,6 +1455,7 @@ sixel_encode_highcolor(
mod_y = 0;
}
}

goto next;

end:
Expand Down

0 comments on commit 9d0a7ff

Please sign in to comment.