summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-09-21 18:27:59 +0200
committerwm4 <wm4@nowhere>2015-09-21 18:27:59 +0200
commitffb905a4b2a53b20ba84384b476743ff871f08db (patch)
tree4cd692a75c0eaebb7f91890b16855b94a6d15ae2
parent60d6f067dd104eaf595072f35c1d45ac6a66aaa2 (diff)
downloadlibass-ffb905a4b2a53b20ba84384b476743ff871f08db.tar.bz2
libass-ffb905a4b2a53b20ba84384b476743ff871f08db.tar.xz
do not skip the second 2 byte sequence on invalid surrogates
-rw-r--r--libass/ass_utils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libass/ass_utils.c b/libass/ass_utils.c
index fef8030..ce57bb3 100644
--- a/libass/ass_utils.c
+++ b/libass/ass_utils.c
@@ -437,11 +437,12 @@ static uint32_t ass_read_utf16be(uint8_t **src, size_t bytes)
goto too_short;
uint32_t cp2 = ((*src)[0] << 8) | (*src)[1];
- *src += 2;
if (cp2 < 0xDC00 || cp2 > 0xDFFF)
return 0xFFFD;
+ *src += 2;
+
cp = 0x10000 + ((cp - 0xD800) << 10) + (cp2 - 0xDC00);
}