From 3ef966c807fe0c325ce5f26c5b2c1a086ee87e61 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 21 Jan 2024 18:28:51 +0000 Subject: allocate number of hdmx widths read, per https://github.com/TeX-Live/texlive-source/pull/63 git-svn-id: svn://tug.org/texlive/trunk@69520 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/ttfdump/ChangeLog | 10 ++++++++++ Build/source/texk/ttfdump/libttf/hdmx.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'Build') diff --git a/Build/source/texk/ttfdump/ChangeLog b/Build/source/texk/ttfdump/ChangeLog index 027949dcf93..994affe1fb7 100644 --- a/Build/source/texk/ttfdump/ChangeLog +++ b/Build/source/texk/ttfdump/ChangeLog @@ -1,3 +1,13 @@ +2024-01-21 Karl Berry + + * libttf/hdmx.c (ttfLoadHDMX): calloc the number of widths that we + actually read, namely numGlyphs+1. I don't understand why this + is numGlyphs+1 and not numGlyphs, per +https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6hdmx.html + but since the program has always read numGlyphs+1, just leaving it. + Report (and alternate fix) from attackoncs, + https://github.com/TeX-Live/texlive-source/pull/63 + 2023-08-13 TANAKA Takuji * tests/ttfdump.test: Make easier to test on Windows. diff --git a/Build/source/texk/ttfdump/libttf/hdmx.c b/Build/source/texk/ttfdump/libttf/hdmx.c index d91b98eb1b3..0332cbcb434 100644 --- a/Build/source/texk/ttfdump/libttf/hdmx.c +++ b/Build/source/texk/ttfdump/libttf/hdmx.c @@ -43,7 +43,7 @@ static void ttfLoadHDMX (FILE *fp,HDMXPtr hdmx,ULONG offset) { hdmx->Records[i].PixelSize = ttfGetBYTE(fp); hdmx->Records[i].MaxWidth = ttfGetBYTE(fp); - hdmx->Records[i].Width = XCALLOC (hdmx->size, BYTE); + hdmx->Records[i].Width = XCALLOC (hdmx->numGlyphs+1, BYTE); fread ((hdmx->Records+i)->Width, sizeof(BYTE), hdmx->numGlyphs+1,fp); } } -- cgit v1.2.3