diff --git a/c/makeotf/makeotf_lib/api/hotconv.h b/c/makeotf/makeotf_lib/api/hotconv.h index 57103cac9..12d3f4023 100644 --- a/c/makeotf/makeotf_lib/api/hotconv.h +++ b/c/makeotf/makeotf_lib/api/hotconv.h @@ -12,7 +12,7 @@ This software is licensed as OpenSource, under the Apache License, Version 2.0. extern "C" { #endif -#define HOT_VERSION 0x010075 /* Library version (1.0.117) */ +#define HOT_VERSION 0x010076 /* Library version (1.0.118) */ /* Major, minor, build = (HOT_VERSION >> 16) & 0xff, (HOT_VERSION >> 8) & 0xff, HOT_VERSION & 0xff) */ /* Warning: this string is now part of heuristic used by CoolType to identify the first round of CoolType fonts which had the backtrack sequence of a chaining diff --git a/c/makeotf/source/cb.c b/c/makeotf/source/cb.c index 0cc10448e..c5fadd88b 100644 --- a/c/makeotf/source/cb.c +++ b/c/makeotf/source/cb.c @@ -48,6 +48,7 @@ extern jmp_buf mark; #define WINDOWS_DECORATIVE (5 << 4) #define MAX_CHAR_NAME_LEN 63 /* Max charname len (inc '\0') */ #define MAX_FINAL_CHAR_NAME_LEN 63 /* Max charname len (inc '\0') */ +#define MAX_UV_CHAR_NAME_LEN 2047 /* length of entire alias string (column) */ #ifdef _MSC_VER /* defined by Microsoft Compiler */ #include @@ -900,6 +901,11 @@ enum { static char *gnameScan(cbCtx h, char *p, unsigned char *action, unsigned char *next, int nameType) { char *start = p; int state = 0; + int nameLimit = MAX_CHAR_NAME_LEN; + + if (nameType == uvName) { + nameLimit = MAX_UV_CHAR_NAME_LEN; + } for (;;) { int actn; @@ -934,7 +940,7 @@ static char *gnameScan(cbCtx h, char *p, unsigned char *action, unsigned char *n return NULL; } if (actn & Q_) { - if (p - start > MAX_CHAR_NAME_LEN) { + if (p - start > nameLimit) { return NULL; /* Maximum glyph name length exceeded */ } return p; diff --git a/c/makeotf/source/main.c b/c/makeotf/source/main.c index 961b70926..31b0939c8 100644 --- a/c/makeotf/source/main.c +++ b/c/makeotf/source/main.c @@ -30,7 +30,7 @@ jmp_buf mark; -#define MAKEOTF_VERSION "2.5.65602" +#define MAKEOTF_VERSION "2.5.65603" /* Warning: this string is now part of heuristic used by CoolType to identify the first round of CoolType fonts which had the backtrack sequence of a chaining contextual substitution ordered incorrectly. Fonts with the old ordering MUST match diff --git a/python/afdko/makeotf.py b/python/afdko/makeotf.py index 53e70daf5..93df335a9 100644 --- a/python/afdko/makeotf.py +++ b/python/afdko/makeotf.py @@ -26,7 +26,7 @@ """ __version__ = """\ -makeotf.py v2.8.4 November 9 2020 +makeotf.py v2.8.5 February 22 2021 """ __methods__ = """ diff --git a/tests/makeotfexe_data/input/bug1310/longGnameGOADB.txt b/tests/makeotfexe_data/input/bug1310/longGnameGOADB.txt new file mode 100644 index 000000000..07fc966e3 --- /dev/null +++ b/tests/makeotfexe_data/input/bug1310/longGnameGOADB.txt @@ -0,0 +1,2 @@ +.notdef .notdef +a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax uni0061 \ No newline at end of file diff --git a/tests/makeotfexe_data/input/bug1310/longUVGOADB.txt b/tests/makeotfexe_data/input/bug1310/longUVGOADB.txt new file mode 100644 index 000000000..9096ff1ca --- /dev/null +++ b/tests/makeotfexe_data/input/bug1310/longUVGOADB.txt @@ -0,0 +1,2 @@ +.notdef .notdef +a a uni0061,uniF020,uniF021,uniF022,uniF023,uniF024,uniF025,uniF026,uniF027,uniF028,uniF029,uniF02A,uniF02B,uniF02C,uniF02D,uniF02E,uniF02F,uniF030,uniF031,uniF032,uniF033,uniF034,uniF035,uniF036,uniF037,uniF038,uniF039,uniF03A,uniF03B,uniF03C,uniF03D,uniF03E,uniF03F,uniF040,uniF041,uniF042,uniF043,uniF044,uniF045,uniF046,uniF047,uniF048,uniF049,uniF04A,uniF04B,uniF04C,uniF04D,uniF04E,uniF04F,uniF050,uniF051,uniF052,uniF053,uniF054,uniF055,uniF056,uniF057,uniF058,uniF059,uniF05A,uniF05B,uniF05C,uniF05D,uniF05E,uniF05F,uniF060,uniF061,uniF062,uniF063,uniF064,uniF065,uniF066,uniF067,uniF068,uniF069,uniF06A,uniF06B,uniF06C,uniF06D,uniF06E,uniF06F,uniF070,uniF071,uniF072,uniF073,uniF074,uniF075,uniF076,uniF077,uniF078,uniF079,uniF07A,uniF07B,uniF07C,uniF07D,uniF07E,uniF07F diff --git a/tests/makeotfexe_test.py b/tests/makeotfexe_test.py index 3dc561432..5be566860 100644 --- a/tests/makeotfexe_test.py +++ b/tests/makeotfexe_test.py @@ -706,3 +706,31 @@ def test_negative_internal_leading_bug1227(): output = f.read() assert (b'[WARNING] Negative internal leading: ' b'win.ascent + win.descent < unitsPerEm') in output + + +@pytest.mark.parametrize( + 'goadb_filename, expected', + [('bug1310/longUVGOADB.txt', False), + ('bug1310/longGnameGOADB.txt', True)]) +def test_glyph_alias_name_limits(goadb_filename, expected): + """ + - 'longUVGOADB' has a 3rd column (UV names) with length > 63. This should + is expected to be allowed (up to MAX_UV_CHAR_NAME_LEN in cb.c) + - 'longGnameGOADB' has 2nd column (glyph name) with a length > 63. This + is expected to raise a warning. + """ + input_filename = "font.pfa" + actual_path = get_temp_file_path() + + cmd = CMD + ['-s', '-e', '-o', + 'r', + 'f', f'_{get_input_path(input_filename)}', + 'o', f'_{actual_path}', + 'gf', f'_{get_input_path(goadb_filename)}'] + + stderr_path = runner(cmd) + + with open(stderr_path, 'rb') as f: + output = f.read() + + assert (b'(record skipped)(gnameError)' in output) is expected