mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/movtextenc: Fix infinite loop due to variable truncation
Regression since af043b839c
.
Fixes ticket #9409.
Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
6507e96e71
commit
bb89a2f64f
|
@ -84,7 +84,7 @@ typedef struct {
|
||||||
uint8_t box_flags;
|
uint8_t box_flags;
|
||||||
StyleBox d;
|
StyleBox d;
|
||||||
uint16_t text_pos;
|
uint16_t text_pos;
|
||||||
uint16_t byte_count;
|
unsigned byte_count;
|
||||||
char **fonts;
|
char **fonts;
|
||||||
int font_count;
|
int font_count;
|
||||||
double font_scale_factor;
|
double font_scale_factor;
|
||||||
|
@ -584,9 +584,9 @@ static void mov_text_cancel_overrides_cb(void *priv, const char *style_name)
|
||||||
mov_text_ass_style_set(s, style);
|
mov_text_ass_style_set(s, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t utf8_strlen(const char *text, int len)
|
static unsigned utf8_strlen(const char *text, int len)
|
||||||
{
|
{
|
||||||
uint16_t i = 0, ret = 0;
|
unsigned i = 0, ret = 0;
|
||||||
while (i < len) {
|
while (i < len) {
|
||||||
char c = text[i];
|
char c = text[i];
|
||||||
if ((c & 0x80) == 0)
|
if ((c & 0x80) == 0)
|
||||||
|
@ -606,7 +606,7 @@ static uint16_t utf8_strlen(const char *text, int len)
|
||||||
|
|
||||||
static void mov_text_text_cb(void *priv, const char *text, int len)
|
static void mov_text_text_cb(void *priv, const char *text, int len)
|
||||||
{
|
{
|
||||||
uint16_t utf8_len = utf8_strlen(text, len);
|
unsigned utf8_len = utf8_strlen(text, len);
|
||||||
MovTextContext *s = priv;
|
MovTextContext *s = priv;
|
||||||
av_bprint_append_data(&s->buffer, text, len);
|
av_bprint_append_data(&s->buffer, text, len);
|
||||||
// If it's not utf-8, just use the byte length
|
// If it's not utf-8, just use the byte length
|
||||||
|
|
Loading…
Reference in New Issue