[date_time_scanner] fix an overflow

Fixes #989
This commit is contained in:
Timothy Stack 2022-06-04 11:05:39 -07:00
parent 3b54260ea4
commit ef8c641e59
6 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,6 @@
# aminclude_static.am generated automatically by Autoconf
# from AX_AM_MACROS_STATIC on Sat Jun 4 07:57:41 PDT 2022
# from AX_AM_MACROS_STATIC on Sat Jun 4 10:09:23 PDT 2022
# Code coverage

View File

@ -211,7 +211,7 @@ date_time_scanner::scan(const char* time_dest,
retval = nullptr;
}
if (retval != nullptr) {
if (retval != nullptr && (retval - time_dest) < time_len) {
/* Try to pull out the milli/micro-second value. */
if (retval[0] == '.' || retval[0] == ',') {
off_t off = (retval - time_dest) + 1;

View File

@ -260,6 +260,8 @@ EXPECTED_FILES = \
$(srcdir)/%reldir%/test_logfile.sh_09bd16e044302f6b121092534708594bdad11b5a.out \
$(srcdir)/%reldir%/test_logfile.sh_290a3c49e53c2229a7400c107338fa0bb38375e2.err \
$(srcdir)/%reldir%/test_logfile.sh_290a3c49e53c2229a7400c107338fa0bb38375e2.out \
$(srcdir)/%reldir%/test_logfile.sh_3fc6bfd8a6160817211f3e14fde957af75b9dbe7.err \
$(srcdir)/%reldir%/test_logfile.sh_3fc6bfd8a6160817211f3e14fde957af75b9dbe7.out \
$(srcdir)/%reldir%/test_logfile.sh_4a2a907fcb069b8d6e65961a7b2e796d6c3a87b1.err \
$(srcdir)/%reldir%/test_logfile.sh_4a2a907fcb069b8d6e65961a7b2e796d6c3a87b1.out \
$(srcdir)/%reldir%/test_logfile.sh_a7037efd0c4bbf51940137a44e57d94e9307e83e.err \

View File

@ -0,0 +1,2 @@
#Date: 20?0-2-02
0

View File

@ -3,6 +3,9 @@
echo ${top_srcdir}
echo ${top_builddir}
printf '#Date:\t20\x800-2-02\n0\n' | run_cap_test \
env TEST_COMMENT="short timestamp" ${lnav_test} -n
cat > rollover_in.0 <<EOF
2600/2 0 00:00:00 0:
00:2 0 00:00:00 0: