fix runtime abort when building with recent clang

This commit is contained in:
dbj 2017-10-31 08:12:11 +00:00
parent 38f0b1a1ab
commit bf6245a414
3 changed files with 33 additions and 2 deletions

View file

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.17 2017/09/06 16:49:29 wiz Exp $
# $NetBSD: Makefile,v 1.18 2017/10/31 08:12:11 dbj Exp $
DISTNAME= texlive-20170524-source
PKGNAME= dvipsk-5.997
PKGREVISION= 1
CATEGORIES= print
MASTER_SITES= ftp://tug.org/historic/systems/texlive/2017/
EXTRACT_SUFX= .tar.xz

View file

@ -1,6 +1,7 @@
$NetBSD: distinfo,v 1.14 2017/06/20 20:50:50 markd Exp $
$NetBSD: distinfo,v 1.15 2017/10/31 08:12:11 dbj Exp $
SHA1 (texlive-20170524-source.tar.xz) = 1c1383ddb1b871c6b8ce49a4ae3c1a33d454a7b6
RMD160 (texlive-20170524-source.tar.xz) = a8430c19fe1727cf308fe03e5838105260c0d71e
SHA512 (texlive-20170524-source.tar.xz) = 18c18940992ab94ce22e22ccd4ad798253ea14ac2ab296a10ea5e9a8da9f33989f2e2641b42b564d1d5fb53bd371da3e68726b676d706b469016ad146cd19daa
Size (texlive-20170524-source.tar.xz) = 63483372 bytes
SHA1 (patch-texk_dvipsk_color.c) = a10b27bb9ae7c97d832c648cd429f5d083282b6b

View file

@ -0,0 +1,29 @@
$NetBSD: patch-texk_dvipsk_color.c,v 1.1 2017/10/31 08:12:11 dbj Exp $
The strcpy stack checker in recent versions of clang get confused
and abort when it appears to copy past the end of the structure,
so be explicit about the variable structure field.
Reported upstream:
http://tug.org/pipermail/tex-k/2017-August/002797.html
--- texk/dvipsk/color.c.orig 2016-11-25 18:08:46.000000000 +0000
+++ texk/dvipsk/color.c
@@ -37,7 +37,7 @@ static struct colorpage {
struct colorpage *next;
integer boploc; /* we use the bop loc as a page indicator */
char *bg;
- char colordat[2];
+ char colordat[];
} *colorhash[COLORHASH];
static char *cstack, *csp, *cend, *bg;
/*
@@ -216,7 +216,7 @@ bopcolor(int outtops)
}
} else {
p = (struct colorpage *)mymalloc((integer)
- (strlen(cstack) + sizeof(struct colorpage) + MAXCOLORLEN));
+ (strlen(cstack) + sizeof(struct colorpage) + MAXCOLORLEN + 2));
p->next = colorhash[h];
p->boploc = pageloc;
strcpy(p->colordat, cstack);