Skip to content

Commit b5bc0e2

Browse files
authored
Fix OOB read/write in Teletext G0 charset remapping
2 parents 600a9a0 + 694b61f commit b5bc0e2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/lib_ccx/telxcc.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,21 @@ void remap_g0_charset(uint8_t c)
434434
{
435435
if (c != primary_charset.current)
436436
{
437+
if (c >= 56)
438+
{
439+
fprintf(stderr, "- G0 Latin National Subset ID 0x%1x.%1x is out of bounds\n", (c >> 3), (c & 0x7));
440+
return;
441+
}
437442
uint8_t m = G0_LATIN_NATIONAL_SUBSETS_MAP[c];
438443
if (m == 0xff)
439444
{
440445
fprintf(stderr, "- G0 Latin National Subset ID 0x%1x.%1x is not implemented\n", (c >> 3), (c & 0x7));
446+
return;
447+
}
448+
else if (m >= 14)
449+
{
450+
fprintf(stderr, "- G0 Latin National Subset index %d is out of bounds\n", m);
451+
return;
441452
}
442453
else
443454
{

0 commit comments

Comments
 (0)