Skip to content

Commit 6441351

Browse files
committed
dont rely on undefined behaviour
1 parent 97c548b commit 6441351

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

toxav/toxav.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,10 @@ inline__ int toxav_recv_video ( ToxAv *av, int32_t call_index, vpx_image_t **out
533533
continue;
534534
}
535535

536-
int8_t i = (int8_t)(packet[0] - call->frame_id);
536+
uint8_t i = packet[0] - call->frame_id;
537537
if(i == 0) {
538538
/* piece of current frame */
539-
} else if(i > 0) {
539+
} else if(i > 0 && i < 128) {
540540
/* recieved a piece of a frame ahead, flush current frame and start reading this new frame */
541541
int rc = vpx_codec_decode(&call->cs->v_decoder, call->frame_buf, call->frame_limit, NULL, 0);
542542
call->frame_id = packet[0];

0 commit comments

Comments
 (0)