1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-20 19:42:53 -08:00
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
__inline.m4
absolute-header.m4
acl.m4
alloca.m4
builtin-expect.m4
byteswap.m4
canonicalize.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
clock_time.m4
close-stream.m4
copy-file-range.m4
count-leading-zeros.m4
count-one-bits.m4
count-trailing-zeros.m4
d-type.m4
dirent_h.m4
dirfd.m4
double-slash-root.m4
dup2.m4
eealloc.m4
environ.m4
errno_h.m4
euidaccess.m4
execinfo.m4
explicit_bzero.m4
extensions.m4
extern-inline.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
faccessat.m4
fcntl.m4
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
flexmember.m4
fpending.m4
fpieee.m4
fstatat.m4
fsusage.m4
fsync.m4
getdtablesize.m4
getgroups.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
getloadavg.m4
getopt.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
gettime.m4
gettimeofday.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
glibc21.m4
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
ieee754-h.m4
include_next.m4
inttypes.m4
largefile.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
limits-h.m4
localtime-buffer.m4
longlong.m4
lstat.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
malloca.m4
manywarnings.m4
mbstate_t.m4
md5.m4
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
minmax.m4
mkostemp.m4
mktime.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
mode_t.m4
multiarch.m4
nocrash.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
nstrftime.m4
off_t.m4
open-cloexec.m4
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
pipe2.m4
pkg.m4
pselect.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
pthread_sigmask.m4
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
regex.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
sha1.m4
sha256.m4
sha512.m4
sig2str.m4
signal_h.m4
socklen.m4
ssize_t.m4
st_dm_mode.m4
stat-time.m4
std-gnu11.m4
stdalign.m4
stddef_h.m4
stdint.m4
stdio_h.m4
stdlib_h.m4
stpcpy.m4
string_h.m4
strnlen.m4
strtoimax.m4
strtoll.m4
symlink.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
sys_select_h.m4
sys_socket_h.m4
sys_stat_h.m4
sys_time_h.m4
sys_types_h.m4
tempname.m4
time_h.m4
time_r.m4 Update from Gnulib 2019-11-26 13:15:41 -08:00
time_rz.m4
timegm.m4
timer_time.m4
timespec.m4
tm_gmtoff.m4
unistd_h.m4 Update from Gnulib 2019-09-22 23:51:44 -07:00
unlocked-io.m4
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
warnings.m4
wchar_t.m4