1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-29 08:31:35 -08:00
emacs/lib
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
..
_Noreturn.h Update from Gnulib 2019-04-13 21:13:57 -07:00
acl-errno-valid.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
acl-internal.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
acl-internal.h Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
acl.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
acl_entries.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
alloca.in.h Update from Gnulib 2019-03-10 23:05:30 -07:00
allocator.c
allocator.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
arg-nonnull.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
at-func.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
binary-io.c Update from Gnulib 2019-06-07 00:44:45 -07:00
binary-io.h Update from Gnulib 2019-06-07 00:44:45 -07:00
byteswap.in.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
c++defs.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
c-ctype.c
c-ctype.h Update from Gnulib 2018-12-31 18:20:07 -08:00
c-strcase.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
c-strcasecmp.c Update from Gnulib 2018-12-31 18:20:07 -08:00
c-strncasecmp.c Update from Gnulib 2018-12-31 18:20:07 -08:00
canonicalize-lgpl.c Fix locating pdump by symlink 2019-06-23 18:19:08 -07:00
careadlinkat.c Update from Gnulib 2019-09-22 23:51:44 -07:00
careadlinkat.h Update from Gnulib 2019-09-22 23:51:44 -07:00
cdefs.h Update from Gnulib 2019-01-27 16:20:40 -08:00
cloexec.c Update from Gnulib 2018-12-31 18:20:07 -08:00
cloexec.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
close-stream.c Update from Gnulib 2018-12-31 18:20:07 -08:00
close-stream.h
copy-file-range.c Use copy_file_range to copy files 2019-06-07 00:44:45 -07:00
COPYING Merge from Gnulib 2017-10-01 18:31:10 -07:00
count-leading-zeros.c logb now works correctly on large integers 2017-03-03 09:19:08 -08:00
count-leading-zeros.h Update from Gnulib 2019-09-22 23:51:44 -07:00
count-one-bits.c
count-one-bits.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
count-trailing-zeros.c
count-trailing-zeros.h Update from Gnulib 2019-09-22 23:51:44 -07:00
diffseq.h Update from Gnulib 2019-09-22 23:51:44 -07:00
dirent.in.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
dirfd.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
dosname.h Update from Gnulib 2018-12-31 18:20:07 -08:00
dtoastr.c
dtotimespec.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
dup2.c Update from Gnulib 2018-12-31 18:20:07 -08:00
errno.in.h Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
euidaccess.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
execinfo.c
execinfo.in.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
explicit_bzero.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
faccessat.c Update from Gnulib 2019-07-06 08:54:54 -07:00
fcntl.c Update from Gnulib 2019-07-06 08:54:54 -07:00
fcntl.in.h Update from Gnulib 2019-09-22 23:51:44 -07:00
fdopendir.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
filemode.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
filemode.h Update from Gnulib 2018-12-31 18:20:07 -08:00
filevercmp.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
filevercmp.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
fingerprint.c Update some URLs 2019-09-23 00:12:52 -07:00
fingerprint.h Update some URLs 2019-09-23 00:12:52 -07:00
flexmember.h Update from Gnulib 2019-05-29 16:34:57 -07:00
fpending.c Update from Gnulib 2018-12-31 18:20:07 -08:00
fpending.h Update from Gnulib 2018-12-31 18:20:07 -08:00
fstatat.c Update from Gnulib 2019-07-06 08:54:54 -07:00
fsusage.c Update from Gnulib 2018-12-31 18:20:07 -08:00
fsusage.h Update from Gnulib 2018-12-31 18:20:07 -08:00
fsync.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
ftoastr.c Update from Gnulib 2019-09-22 23:51:44 -07:00
ftoastr.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
get-permissions.c Update from Gnulib 2019-09-22 23:51:44 -07:00
getdtablesize.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
getgroups.c Update from Gnulib 2018-12-31 18:20:07 -08:00
getloadavg.c Update from Gnulib 2019-03-10 23:05:30 -07:00
getopt-cdefs.in.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
getopt-core.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
getopt-ext.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
getopt-pfx-core.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
getopt-pfx-ext.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
getopt.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
getopt.in.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
getopt1.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
getopt_int.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
gettext.h Update from Gnulib 2019-01-27 16:20:40 -08:00
gettime.c Update from Gnulib 2018-12-31 18:20:07 -08:00
gettimeofday.c Update from Gnulib. 2019-03-25 14:55:49 -07:00
gnulib.mk.in etags: remove some arbitrary limits 2019-11-26 13:57:00 -08:00
group-member.c Update from Gnulib 2018-12-31 18:20:07 -08:00
ieee754.in.h Update from Gnulib 2019-09-22 23:51:44 -07:00
ignore-value.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
intprops.h Update from Gnulib 2019-11-26 13:15:41 -08:00
inttypes.in.h Update from Gnulib 2019-10-24 14:35:06 -07:00
libc-config.h Update from Gnulib 2018-12-31 18:20:07 -08:00
limits.in.h Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
localtime-buffer.c Update from Gnulib 2018-12-31 18:20:07 -08:00
localtime-buffer.h Update from Gnulib 2018-12-31 18:20:07 -08:00
lstat.c Update from Gnulib 2019-02-25 08:27:40 -08:00
Makefile.in Fix extraclean in a different way for info+lib/sys 2019-06-20 11:19:09 -07:00
malloca.c Fix locating pdump by symlink 2019-06-23 18:19:08 -07:00
malloca.h Fix locating pdump by symlink 2019-06-23 18:19:08 -07:00
md5.c Update from Gnulib 2018-12-31 18:20:07 -08:00
md5.h Update from Gnulib 2018-12-31 18:20:07 -08:00
memmem.c Replace executable’s fingerprint in place 2019-04-14 17:06:09 -07:00
mempcpy.c etags: remove some arbitrary limits 2019-11-26 13:57:00 -08:00
memrchr.c Update from Gnulib 2018-12-31 18:20:07 -08:00
min-max.h
minmax.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
mkostemp.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
mktime-internal.h Update from Gnulib 2019-04-30 09:45:08 -07:00
mktime.c Update from Gnulib 2019-09-22 23:51:44 -07:00
nstrftime.c Update from Gnulib 2019-10-24 14:35:06 -07:00
open.c Update from Gnulib 2019-10-11 18:24:19 -07:00
openat-die.c Limit <config.h>’s includes 2016-09-30 12:38:52 -07:00
openat-priv.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
openat-proc.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
openat.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
pathmax.h Update from Gnulib 2019-09-22 23:51:44 -07:00
pipe2.c Update from Gnulib 2019-09-22 23:51:44 -07:00
pselect.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
pthread_sigmask.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
putenv.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
qcopy-acl.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
readlink.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
readlinkat.c Update from Gnulib 2019-07-06 08:54:54 -07:00
regcomp.c Update from Gnulib 2019-10-11 18:24:19 -07:00
regex.c Update from Gnulib 2018-12-31 18:20:07 -08:00
regex.h Update from Gnulib 2018-12-31 18:20:07 -08:00
regex_internal.c Update from Gnulib 2019-10-11 18:24:19 -07:00
regex_internal.h Update from Gnulib 2019-10-11 18:24:19 -07:00
regexec.c Update from Gnulib 2019-11-26 13:15:41 -08:00
root-uid.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
save-cwd.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
save-cwd.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
set-permissions.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
sha1.c Update from Gnulib 2018-12-31 18:20:07 -08:00
sha1.h Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
sha256.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
sha256.h Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
sha512.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
sha512.h Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
sig2str.c Update from Gnulib 2018-12-31 18:20:07 -08:00
sig2str.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
signal.in.h Update from Gnulib 2019-11-26 13:15:41 -08:00
stat-time.c
stat-time.h Update from Gnulib. 2019-03-25 14:55:49 -07:00
stdalign.in.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
stddef.in.h Update from Gnulib 2019-09-22 23:51:44 -07:00
stdint.in.h Update from Gnulib 2019-11-26 13:15:41 -08:00
stdio-impl.h Update from Gnulib 2019-10-11 18:24:19 -07:00
stdio.in.h Update from Gnulib 2019-11-26 13:15:41 -08:00
stdlib.in.h Update from Gnulib 2019-11-26 13:15:41 -08:00
stpcpy.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
str-two-way.h Update from Gnulib 2019-09-22 23:51:44 -07:00
strftime.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
string.in.h Update from Gnulib 2019-11-26 13:15:41 -08:00
strnlen.c Avoid some strlen work, primarily via strnlen 2019-06-25 14:55:08 -07:00
strtoimax.c Update from Gnulib 2018-12-31 18:20:07 -08:00
strtol.c Update from Gnulib 2018-12-31 18:20:07 -08:00
strtoll.c Update from Gnulib 2018-12-31 18:20:07 -08:00
symlink.c Update copyright year to 2019 2019-01-01 01:01:13 +00:00
sys_select.in.h Update from Gnulib 2019-11-26 13:15:41 -08:00
sys_stat.in.h Update from Gnulib 2019-01-27 16:20:40 -08:00
sys_time.in.h Update from Gnulib 2019-11-26 13:15:41 -08:00
sys_types.in.h Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
tempname.c Update from Gnulib 2018-12-31 18:20:07 -08:00
tempname.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
time-internal.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
time.in.h Update from Gnulib 2019-11-26 13:15:41 -08:00
time_r.c Update from Gnulib 2018-12-31 18:20:07 -08:00
time_rz.c Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
timegm.c Update from Gnulib 2019-09-22 23:51:44 -07:00
timespec-add.c Update from Gnulib 2019-11-05 22:59:27 -08:00
timespec-sub.c Update from Gnulib 2019-11-05 22:59:27 -08:00
timespec.c
timespec.h Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
u64.c
u64.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
unistd.c
unistd.in.h Update from Gnulib 2019-11-26 13:15:41 -08:00
unlocked-io.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
utimens.c Update from Gnulib. 2019-03-25 14:55:49 -07:00
utimens.h Update copyright year to 2019 2019-01-01 01:01:13 +00:00
verify.h Update from Gnulib 2019-10-24 14:35:06 -07:00
vla.h Update from Gnulib 2019-02-25 08:27:40 -08:00
warn-on-use.h Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
xalloc-oversized.h Update from Gnulib 2018-12-31 18:20:07 -08:00