1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-16 11:55:42 +00:00
mpv/sub
wm4 1e73da47da sub: fix crash with certain uses of --vf=sub
If, for some reason, the subtitle renderer attempts to render a
subtitle before SD_CTRL_SET_VIDEO_PARAMS was called, it passed a
value calculated from invalid values. This can happen with --vf=sub
and --start. The crash happens if 1. there was a subtitle packet that
falls into the timestamp of the rendered video frame, 2. the playloop
hasn't informed the subtitle decoder about the video resolution yet
(normally unneeded, because that is used for weird corner cases only,
so this code is a bit fuzzy), and 3. something actually requests a
frame to be drawn from the subtitle renderer, like with vf_sub.

The actual crash was due to passing NaN as pixel aspect to libass,
which then created glyphs with ridiculous sizes, involving a few
integer overflows and unchecked mallocs.

The sd_lavc.c and sd_spu.c cases probably don't crash, but I'm not
sure, and it's better fix them anyway.

Not bothering with sd_spu.c, this crap is for compatibility and will
be removed soon.

Note that this would have been no problem, had the code checked whether
SD_CTRL_SET_VIDEO_PARAMS was actually called. This commit adds such a
check (although it basically checks after using the parameters).

Regression since 49caa0a7 and 633fde4a.
2014-01-26 18:58:40 +01:00
..
ass_mp.c msg: rename mp_msg_log -> mp_msg 2013-12-21 22:13:04 +01:00
ass_mp.h sub/osd: mp_msg conversions 2013-12-21 20:50:13 +01:00
dec_sub.c sub: uglify sub decoder with locking 2014-01-17 23:21:17 +01:00
dec_sub.h sub: uglify sub decoder with locking 2014-01-17 23:21:17 +01:00
draw_bmp.c Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
draw_bmp.h Rename sub.c/.h to osd.c/.h 2013-11-24 14:44:58 +01:00
find_subfiles.c vo: dropping subtitle files on the VO window adds them as subtitle files 2014-01-04 01:27:29 +01:00
find_subfiles.h vo: dropping subtitle files on the VO window adds them as subtitle files 2014-01-04 01:27:29 +01:00
img_convert.c Reduce recursive config.h inclusions in headers 2013-12-18 17:12:21 +01:00
img_convert.h Revert "sub: support straight alpha additionally to premultiplied alpha" 2013-08-12 02:49:22 +02:00
osd_dummy.c sub: uglify OSD code path with locking 2014-01-18 01:27:43 +01:00
osd_font.otf osc: rename osd_font, add some glyphs 2013-09-08 03:35:04 +02:00
osd_libass.c sub: uglify OSD code path with locking 2014-01-18 01:27:43 +01:00
osd_state.h sub: uglify OSD code path with locking 2014-01-18 01:27:43 +01:00
osd.c video/out: don't access aspdat in VOs 2014-01-22 00:35:52 +01:00
osd.h video/out: don't access aspdat in VOs 2014-01-22 00:35:52 +01:00
sd_ass.c sub: fix crash with certain uses of --vf=sub 2014-01-26 18:58:40 +01:00
sd_lavc_conv.c sub/osd: mp_msg conversions 2013-12-21 20:50:13 +01:00
sd_lavc.c sub: fix crash with certain uses of --vf=sub 2014-01-26 18:58:40 +01:00
sd_lavf_srt.c Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
sd_microdvd.c Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
sd_movtext.c
sd_spu.c sub: fix crash with certain uses of --vf=sub 2014-01-26 18:58:40 +01:00
sd_srt.c sub/osd: mp_msg conversions 2013-12-21 20:50:13 +01:00
sd.h sub/osd: mp_msg conversions 2013-12-21 20:50:13 +01:00
spudec.c sub/osd: mp_msg conversions 2013-12-21 20:50:13 +01:00
spudec.h sub/osd: mp_msg conversions 2013-12-21 20:50:13 +01:00