emacs/m4
Paul Eggert cffa5703b9 etags: remove some arbitrary limits
etags had undefined behavior if input files, lines, tags, etc.,
had more than INT_MAX bytes.  Clean up the usage of integer types
to fix the overflow errors I found.
* admin/merge-gnulib (GNULIB_MODULES): Add mempcpy.
* lib-src/etags.c: Include inttypes.h, intprops.h.
(memcpyz): New function.  Use it to simplify several occurrences
of memcpy followed by storing a trailing '\0'.
(xnew): Use xnmalloc, to catch overflow on integer multiplication.
(xrnew): Change last arg to multiplier.  The type is not needed.
All callers changed.
(node, lineno, charno, linecharno, invalidcharno, make_tag):
(pfnote, add_node, number_len, C_symtype, lbz, Makefile_targets)
(readline):
Use intmax_t for line numbers and character positions, instead of
int or long.
(linebuffer, make_tag, pfnote, total_size_of_entries, put_entry)
(in_word_set, C_symtype, token, cstack, pushclass_above):
(popclass_above, write_classname, consider_token, C_entries)
(Ruby_functions, Makefile_targets, Lua_functions, TeX_commands)
(TeX_decode_env, erlang_func, erlang_attribute, erlang_atom)
(substitute, regex_tag_multiline, nocase_tail, readline_interval)
(readline, savenstr, concat, etags_getcwd, relative_filename)
(linebuffer_setlen):
Use ptrdiff_t for object sizes, instead of int or long or unsigned
or size_t.
(write_classname, C_entries):
Avoid sprintf, as the result could exceed INT_MAX bytes
and then behavior goes haywire.
(main): Use int, instead of unsigned, for argv counts.
(get_language_from_filename): Use bool for boolean.
(Ruby_functions): Prefer strcpy to memcpy when copying "=".
(linebuffer_setlen): Use ‘if’ instead of ‘while’.
(memory_full, xnmalloc, xnrealloc): New functions.
(xmalloc): Use memory_full, and take a ptrdiff_t instead of a size_t.
(xrealloc): Remove; no longer needed.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/mempcpy.c, m4/mempcpy.m4: New files, copied from Gnulib.
2019-11-26 13:57:00 -08:00
..
00gnulib.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
__inline.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
absolute-header.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
acl.m4 Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
alloca.m4 Update from Gnulib 2019-03-10 23:05:30 -07:00
builtin-expect.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
byteswap.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
canonicalize.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
clock_time.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
close-stream.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
copy-file-range.m4 Use copy_file_range to copy files 2019-06-07 00:44:45 -07:00
count-leading-zeros.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
count-one-bits.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
count-trailing-zeros.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
d-type.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
dirent_h.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
dirfd.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
double-slash-root.m4 Fix locating pdump by symlink 2019-06-23 18:19:08 -07:00
dup2.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
eealloc.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
environ.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
errno_h.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
euidaccess.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
execinfo.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
explicit_bzero.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
extensions.m4 Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
extern-inline.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
faccessat.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
fcntl.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
fcntl_h.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
fdopendir.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
filemode.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
flexmember.m4 Update from Gnulib 2019-05-29 16:34:57 -07:00
fpending.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
fpieee.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
fstatat.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
fsusage.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
fsync.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
getdtablesize.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
getgroups.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
getloadavg.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
getopt.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
gettime.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
gettimeofday.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
glibc21.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
gnulib-common.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
gnulib-comp.m4 etags: remove some arbitrary limits 2019-11-26 13:57:00 -08:00
group-member.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
ieee754-h.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
include_next.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
inttypes.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
largefile.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
limits-h.m4 Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
localtime-buffer.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
longlong.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
lstat.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
malloca.m4 Fix locating pdump by symlink 2019-06-23 18:19:08 -07:00
manywarnings.m4 Update from Gnulib 2019-05-03 12:17:31 -07:00
mbstate_t.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
md5.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
memmem.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
mempcpy.m4 etags: remove some arbitrary limits 2019-11-26 13:57:00 -08:00
memrchr.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
minmax.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
mkostemp.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
mktime.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
mode_t.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
multiarch.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
nocrash.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
nstrftime.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
off_t.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
open-cloexec.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
open-slash.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
open.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
pathmax.m4 Fix locating pdump by symlink 2019-06-23 18:19:08 -07:00
pipe2.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
pkg.m4 Merge from pkg-config 2018-02-11 13:10:41 -08:00
pselect.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
pthread_sigmask.m4 Update from Gnulib 2019-07-06 08:54:54 -07:00
putenv.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
readlink.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
readlinkat.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
regex.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
sha1.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
sha256.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
sha512.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
sig2str.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
signal_h.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
socklen.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
ssize_t.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
st_dm_mode.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
stat-time.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
std-gnu11.m4 Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
stdalign.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
stddef_h.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
stdint.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
stdio_h.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
stdlib_h.m4 Update from Gnulib 2019-02-02 13:15:10 -08:00
stpcpy.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
string_h.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
strnlen.m4 Avoid some strlen work, primarily via strnlen 2019-06-25 14:55:08 -07:00
strtoimax.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
strtoll.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
symlink.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
sys_select_h.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
sys_socket_h.m4 Update from Gnulib 2019-07-06 08:54:54 -07:00
sys_stat_h.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
sys_time_h.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
sys_types_h.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
tempname.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
time_h.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
time_r.m4 Update from Gnulib 2019-11-26 13:15:41 -08:00
time_rz.m4 Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
timegm.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
timer_time.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
timespec.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
tm_gmtoff.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
unistd_h.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
unlocked-io.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00
utimens.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
utimes.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
vararrays.m4 Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
warnings.m4 Update from Gnulib 2018-12-31 18:20:07 -08:00
wchar_t.m4 Update copyright year to 2019 2019-01-01 01:01:13 +00:00