summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-10-14 15:51:36 +0200
committerAnton Kindestam <antonki@kth.se>2018-12-06 10:34:06 +0100
commit32385a784c747997199d49cb15cffe455208564e (patch)
tree4a0349c24520e90d57d2cd646157c81427bf417f
parentaf9722cd3e9def4b09d50b6418e926567977b99b (diff)
downloadmpv-32385a784c747997199d49cb15cffe455208564e.tar.bz2
mpv-32385a784c747997199d49cb15cffe455208564e.tar.xz
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.
-rw-r--r--sub/osd.c6
1 files 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);