Skip to content

Commit

Permalink
add checks for grfX handlers to prevent divide-by-zero with slimproto (
Browse files Browse the repository at this point in the history
…#424)

Thank you!
  • Loading branch information
wizmo2 committed Jun 7, 2024
1 parent 38d28ae commit 40a698e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/squeezelite/displayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ void draw_VU(struct GDS_Device * display, int level, int x, int y, int width, bo
static void grfe_handler( u8_t *data, int len) {
struct grfe_packet *pkt = (struct grfe_packet*) data;

GDS_CHECK_FOR_DEVICE(display,return);
// we don't support transition, simply claim we're done
if (pkt->transition != 'c') {
LOG_INFO("Transition %c requested with offset %hu, param %d", pkt->transition, pkt->offset, pkt->param);
Expand Down Expand Up @@ -773,7 +774,8 @@ static void grfs_handler(u8_t *data, int len) {
htons(pkt->width), // last column of animation that contains a "full" screen
htons(pkt->offset) // offset if multiple packets are sent
);


GDS_CHECK_FOR_DEVICE(display,return);
// new grfs frame, build scroller info
if (!offset) {
// use the display as a general lock
Expand Down Expand Up @@ -820,6 +822,7 @@ static void grfg_handler(u8_t *data, int len) {

LOG_DEBUG("gfrg s:%hu w:%hu (len:%u)", htons(pkt->screen), htons(pkt->width), len);

GDS_CHECK_FOR_DEVICE(display,return);
// full screen artwork or for small screen, visu has priority when full screen
if (((visu.mode & VISU_ESP32) && !visu.col && visu.row < displayer.height) || artwork.full) {
return;
Expand Down Expand Up @@ -864,6 +867,7 @@ static void grfa_handler(u8_t *data, int len) {
int offset = htonl(pkt->offset);
int length = htonl(pkt->length);

GDS_CHECK_FOR_DEVICE(display,return);
// when using full screen visualizer on small screen there is a brief overlay
artwork.enable = (length != 0);

Expand Down

0 comments on commit 40a698e

Please sign in to comment.