• Paul Eggert's avatar
    etags: remove some arbitrary limits · cffa5703
    Paul Eggert authored
    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.
    cffa5703
Name
Last commit
Last update
..
00gnulib.m4 Loading commit data...
__inline.m4 Loading commit data...
absolute-header.m4 Loading commit data...
acl.m4 Loading commit data...
alloca.m4 Loading commit data...
builtin-expect.m4 Loading commit data...
byteswap.m4 Loading commit data...
canonicalize.m4 Loading commit data...
clock_time.m4 Loading commit data...
close-stream.m4 Loading commit data...
copy-file-range.m4 Loading commit data...
count-leading-zeros.m4 Loading commit data...
count-one-bits.m4 Loading commit data...
count-trailing-zeros.m4 Loading commit data...
d-type.m4 Loading commit data...
dirent_h.m4 Loading commit data...
dirfd.m4 Loading commit data...
double-slash-root.m4 Loading commit data...
dup2.m4 Loading commit data...
eealloc.m4 Loading commit data...
environ.m4 Loading commit data...
errno_h.m4 Loading commit data...
euidaccess.m4 Loading commit data...
execinfo.m4 Loading commit data...
explicit_bzero.m4 Loading commit data...
extensions.m4 Loading commit data...
extern-inline.m4 Loading commit data...
faccessat.m4 Loading commit data...
fcntl.m4 Loading commit data...
fcntl_h.m4 Loading commit data...
fdopendir.m4 Loading commit data...
filemode.m4 Loading commit data...
flexmember.m4 Loading commit data...
fpending.m4 Loading commit data...
fpieee.m4 Loading commit data...
fstatat.m4 Loading commit data...
fsusage.m4 Loading commit data...
fsync.m4 Loading commit data...
getdtablesize.m4 Loading commit data...
getgroups.m4 Loading commit data...
getloadavg.m4 Loading commit data...
getopt.m4 Loading commit data...
gettime.m4 Loading commit data...
gettimeofday.m4 Loading commit data...
glibc21.m4 Loading commit data...
gnulib-common.m4 Loading commit data...
gnulib-comp.m4 Loading commit data...
group-member.m4 Loading commit data...
ieee754-h.m4 Loading commit data...
include_next.m4 Loading commit data...
inttypes.m4 Loading commit data...
largefile.m4 Loading commit data...
limits-h.m4 Loading commit data...
localtime-buffer.m4 Loading commit data...
longlong.m4 Loading commit data...
lstat.m4 Loading commit data...
malloca.m4 Loading commit data...
manywarnings.m4 Loading commit data...
mbstate_t.m4 Loading commit data...
md5.m4 Loading commit data...
memmem.m4 Loading commit data...
mempcpy.m4 Loading commit data...
memrchr.m4 Loading commit data...
minmax.m4 Loading commit data...
mkostemp.m4 Loading commit data...
mktime.m4 Loading commit data...
mode_t.m4 Loading commit data...
multiarch.m4 Loading commit data...
nocrash.m4 Loading commit data...
nstrftime.m4 Loading commit data...
off_t.m4 Loading commit data...
open-cloexec.m4 Loading commit data...
open-slash.m4 Loading commit data...
open.m4 Loading commit data...
pathmax.m4 Loading commit data...
pipe2.m4 Loading commit data...
pkg.m4 Loading commit data...
pselect.m4 Loading commit data...
pthread_sigmask.m4 Loading commit data...
putenv.m4 Loading commit data...
readlink.m4 Loading commit data...
readlinkat.m4 Loading commit data...
regex.m4 Loading commit data...
sha1.m4 Loading commit data...
sha256.m4 Loading commit data...
sha512.m4 Loading commit data...
sig2str.m4 Loading commit data...
signal_h.m4 Loading commit data...
socklen.m4 Loading commit data...
ssize_t.m4 Loading commit data...
st_dm_mode.m4 Loading commit data...
stat-time.m4 Loading commit data...
std-gnu11.m4 Loading commit data...
stdalign.m4 Loading commit data...
stddef_h.m4 Loading commit data...
stdint.m4 Loading commit data...
stdio_h.m4 Loading commit data...
stdlib_h.m4 Loading commit data...
stpcpy.m4 Loading commit data...
string_h.m4 Loading commit data...
strnlen.m4 Loading commit data...
strtoimax.m4 Loading commit data...
strtoll.m4 Loading commit data...
symlink.m4 Loading commit data...
sys_select_h.m4 Loading commit data...
sys_socket_h.m4 Loading commit data...
sys_stat_h.m4 Loading commit data...
sys_time_h.m4 Loading commit data...
sys_types_h.m4 Loading commit data...
tempname.m4 Loading commit data...
time_h.m4 Loading commit data...
time_r.m4 Loading commit data...
time_rz.m4 Loading commit data...
timegm.m4 Loading commit data...
timer_time.m4 Loading commit data...
timespec.m4 Loading commit data...
tm_gmtoff.m4 Loading commit data...
unistd_h.m4 Loading commit data...
unlocked-io.m4 Loading commit data...
utimens.m4 Loading commit data...
utimes.m4 Loading commit data...
vararrays.m4 Loading commit data...
warnings.m4 Loading commit data...
wchar_t.m4 Loading commit data...