From 3fd89a2e9d3052b0a7283b0d5d667499926a1d0d Mon Sep 17 00:00:00 2001 From: Hironobu Yamashita Date: Wed, 2 Jun 2021 14:28:06 +0000 Subject: dvipdfm-x/pdfencoding.c: fix a segmentation fault (M. Hosoda) git-svn-id: svn://tug.org/texlive/trunk@59429 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfm-x/ChangeLog | 6 ++++++ Build/source/texk/dvipdfm-x/pdfencoding.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index e1fd390108d..2616cbae93c 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,9 @@ +2021-06-02 Masamichi HOSODA + + * pdfencoding.c: Fix a segmentation fault on pdfencoding. + https://tug.org/pipermail/dvipdfmx/2021-May/000270.html + https://github.com/texjporg/tex-jp-build/issues/114 + 2021-05-31 Karl Berry * dvipdfmx.1: bug reporting address now dvipdfmx@tug.org diff --git a/Build/source/texk/dvipdfm-x/pdfencoding.c b/Build/source/texk/dvipdfm-x/pdfencoding.c index 777dbcd2d50..f1206aeb8f8 100644 --- a/Build/source/texk/dvipdfm-x/pdfencoding.c +++ b/Build/source/texk/dvipdfm-x/pdfencoding.c @@ -74,7 +74,7 @@ typedef struct pdf_encoding char *glyphs[256]; /* ".notdef" must be represented as NULL */ char is_used[256]; - struct pdf_encoding *baseenc; + int baseenc_id; pdf_obj *tounicode; pdf_obj *resource; @@ -100,7 +100,7 @@ pdf_init_encoding_struct (pdf_encoding *encoding) encoding->tounicode = NULL; - encoding->baseenc = NULL; + encoding->baseenc_id= -1; encoding->resource = NULL; encoding->flags = 0; @@ -437,7 +437,7 @@ pdf_encoding_new_encoding (const char *enc_name, const char *ident, if (baseenc_id < 0 || !pdf_encoding_is_predefined(baseenc_id)) ERROR("Illegal base encoding %s for encoding %s\n", baseenc_name, encoding->enc_name); - encoding->baseenc = &enc_cache.encodings[baseenc_id]; + encoding->baseenc_id = baseenc_id; } if (flags & FLAG_IS_PREDEFINED) @@ -464,9 +464,11 @@ void pdf_encoding_complete (void) */ int with_base = !(encoding->flags & FLAG_USED_BY_TYPE3) || pdf_check_version(1, 4) >= 0; + pdf_encoding *baseenc = (encoding->baseenc_id < 0) ? + NULL : &enc_cache.encodings[encoding->baseenc_id]; ASSERT(!encoding->resource); encoding->resource = create_encoding_resource(encoding, - with_base ? encoding->baseenc : NULL); + with_base ? baseenc : NULL); ASSERT(!encoding->tounicode); encoding->tounicode = pdf_create_ToUnicode_CMap(encoding->enc_name, encoding->glyphs, -- cgit v1.2.3