Skip to content

Commit

Permalink
load_text: prevent overflow on long lines conversion to utf8 (#2386)
Browse files Browse the repository at this point in the history
  • Loading branch information
aureliendavid authored and rbouqueau committed Apr 16, 2023
1 parent 7c07b13 commit 6d6c453
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/filters/load_text.c
Expand Up @@ -342,6 +342,12 @@ char *gf_text_get_utf8_line(char *szLine, u32 lineSize, FILE *txt_in, s32 unicod
}
szLineConv[j] = szLine[i];
j++;

if (j >= GF_ARRAY_LENGTH(szLineConv) - 1) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_PARSER, ("[TXTIn] Line too long to convert to utf8 (len: %d)\n", len));
break;
}

}
szLineConv[j] = 0;
strcpy(szLine, szLineConv);
Expand Down

0 comments on commit 6d6c453

Please sign in to comment.