texlive[45639] Build/source/texk/kpathsea: (do_subdir): arg cannot be
commits+karl at tug.org
commits+karl at tug.org
Sun Oct 29 22:53:23 CET 2017
Revision: 45639
http://tug.org/svn/texlive?view=revision&revision=45639
Author: karl
Date: 2017-10-29 22:53:23 +0100 (Sun, 29 Oct 2017)
Log Message:
-----------
(do_subdir): arg cannot be empty; make assert robust
Modified Paths:
--------------
trunk/Build/source/texk/kpathsea/ChangeLog
trunk/Build/source/texk/kpathsea/elt-dirs.c
Modified: trunk/Build/source/texk/kpathsea/ChangeLog
===================================================================
--- trunk/Build/source/texk/kpathsea/ChangeLog 2017-10-29 21:26:05 UTC (rev 45638)
+++ trunk/Build/source/texk/kpathsea/ChangeLog 2017-10-29 21:53:23 UTC (rev 45639)
@@ -1,3 +1,9 @@
+2017-10-29 Karl Berry <karl at freefriends.org>
+
+ * elt-dirs.c (do_subdir): assert must include elt_length>0
+ to guarantee the assert of elt[elt_length-1] is valid.
+ From Doug McKenna, personal mail, 29oct17.
+
2017-10-25 Karl Berry <karl at tug.org>
* expand.c (brace_expand): do not look past the terminating
Modified: trunk/Build/source/texk/kpathsea/elt-dirs.c
===================================================================
--- trunk/Build/source/texk/kpathsea/elt-dirs.c 2017-10-29 21:26:05 UTC (rev 45638)
+++ trunk/Build/source/texk/kpathsea/elt-dirs.c 2017-10-29 21:53:23 UTC (rev 45639)
@@ -1,6 +1,7 @@
/* elt-dirs.c: Translate a path element to its corresponding director{y,ies}.
- Copyright 1993, 1994, 1995, 1996, 1997, 2008, 2009, 2010, 2011, 2016 Karl Berry.
+ Copyright 1993, 1994, 1995, 1996, 1997, 2008, 2009, 2010, 2011, 2016,
+ 2017 Karl Berry.
Copyright 1997, 1998, 1999, 2000, 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -100,7 +101,7 @@
/* POST is a pointer into the original element (which may no longer be
ELT) to just after the doubled DIR_SEP, perhaps to the null. Append
subdirectories of ELT (up to ELT_LENGTH, which must be a /) to
- STR_LIST_PTR. */
+ STR_LIST_PTR. ELT must not be the empty string (or NULL). */
#ifdef WIN32
/* Shared across recursive calls, it acts like a stack. */
@@ -127,8 +128,9 @@
/* Some old compilers don't allow aggregate initialization. */
name = fn_copy0 (elt, elt_length);
- assert (IS_DIR_SEP_CH (elt[elt_length - 1])
- || IS_DEVICE_SEP (elt[elt_length - 1]));
+ assert (elt_length > 0
+ && (IS_DIR_SEP_CH (elt[elt_length - 1])
+ || IS_DEVICE_SEP (elt[elt_length - 1])));
#if defined (WIN32)
strcpy(dirname, FN_STRING(name));
More information about the tex-live-commits
mailing list