From 32385a784c747997199d49cb15cffe455208564e Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 14 Oct 2018 15:51:36 +0200 Subject: osd: another shitty pointless UB The pointer could be NULL if the number of bytes to copy was 0. In a sane world, this would be fine, but not the current world. --- sub/osd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sub/osd.c b/sub/osd.c index 8bd32eeb6a..495aa45e3a 100644 --- a/sub/osd.c +++ b/sub/osd.c @@ -217,8 +217,10 @@ void osd_set_progbar(struct osd_state *osd, struct osd_progbar_state *s) osd_obj->progbar_state.value = s->value; osd_obj->progbar_state.num_stops = s->num_stops; MP_TARRAY_GROW(osd_obj, osd_obj->progbar_state.stops, s->num_stops); - memcpy(osd_obj->progbar_state.stops, s->stops, - sizeof(osd_obj->progbar_state.stops[0]) * s->num_stops); + if (s->num_stops) { + memcpy(osd_obj->progbar_state.stops, s->stops, + sizeof(osd_obj->progbar_state.stops[0]) * s->num_stops); + } osd_obj->osd_changed = true; osd->want_redraw_notification = true; pthread_mutex_unlock(&osd->lock); -- cgit v1.2.3