bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #65451] [PATCH] Remove redundant tests


From: G. Branden Robinson
Subject: [bug #65451] [PATCH] Remove redundant tests
Date: Sat, 13 Jul 2024 16:36:08 -0400 (EDT)

Update of bug #65451 (group groff):

                  Status:             In Progress => Fixed                  
             Open/Closed:                    Open => Closed                 
         Planned Release:                    None => 1.24.0                 

    _______________________________________________________

Follow-up Comment #5:


a3b36bbe9940d03311d6536cdc095aba1
Author: Alejandro Colomar <alx@kernel.org>
Date:   Sat Mar 16 13:35:15 2024 +0100

    [grolbp]: Fix range check after `strtol()`.
    
    * src/devices/grolbp/lbp.cpp (main): Fix range check after `strtol()`.
      In case INT_MAX==LONG_MAX, we need to check for ERANGE to reject high
      values.  The test 'n > INT_MAX' would never be true.
    
    Fixes: d21a9dbc7a83 ("* src/devices/grolbp/lbp.cc: (long_options): Add
-w/--linewidth option.")
    Link: <https://savannah.gnu.org/bugs/?65451>
    Link: <https://savannah.gnu.org/bugs/?65452>
    Cc: "G. Branden Robinson" <branden@debian.org>
    Cc: Dave Kemper <saint.snit@gmail.com>
    Cc: "James K. Lowden" <jklowden@schemamania.org>
    Cc: Colin Watson <cjwatson@debian.org>
    Cc: Werner LEMBERG <wl@gnu.org>
    Cc: James Clark <jjc@jclark.com>
    Signed-off-by: Alejandro Colomar <alx@kernel.org>

commit a4fc074b36b2a6054608eb2f7e83d7b5803b8b58
Author: Alejandro Colomar <alx@kernel.org>
Date:   Sat Mar 16 13:35:11 2024 +0100

    [indxbib]: Collapse related tests.
    
    * src/utils/indxbib/indxbib.cpp (check_integer_arg): Collapse related
      tests.
    
    Fixes: d7b36a45fc3f ("[indxbib]: Mitigate Savannah #65452.")
    Link: <https://savannah.gnu.org/bugs/?65452>
    Cc: "G. Branden Robinson" <branden@debian.org>
    Cc: Dave Kemper <saint.snit@gmail.com>
    Cc: "James K. Lowden" <jklowden@schemamania.org>
    Cc: Colin Watson <cjwatson@debian.org>
    Cc: Werner LEMBERG <wl@gnu.org>
    Cc: James Clark <jjc@jclark.com>
    Signed-off-by: Alejandro Colomar <alx@kernel.org>

commit dcf9bfbef5db9ab0286ac0cda2105616397f91d1
Author: Alejandro Colomar <alx@kernel.org>
Date:   Sat Mar 16 13:35:06 2024 +0100

    [indxbib]: Remove dead code.
    
    * src/utils/indxbib/indxbib.cpp (check_integer_arg): Remove dead code.
      The tests (LONG_MAX > INT_MAX && n > INT_MAX) and (n > INT_MAX) are
      equivalent.
    
    Fixes: d7b36a45fc3f ("[indxbib]: Mitigate Savannah #65452.")
    Link: <https://savannah.gnu.org/bugs/?65452>
    Link: <https://lists.gnu.org/archive/html/groff/2024-03/msg00065.html>
    Cc: "G. Branden Robinson" <branden@debian.org>
    Cc: Dave Kemper <saint.snit@gmail.com>
    Cc: "James K. Lowden" <jklowden@schemamania.org>
    Cc: Colin Watson <cjwatson@debian.org>
    Cc: Werner LEMBERG <wl@gnu.org>
    Cc: James Clark <jjc@jclark.com>
    Signed-off-by: Alejandro Colomar <alx@kernel.org>

commit 573dcdc12ee01dc476c1c06a8b6fe5c8f9958ad3
Author: Alejandro Colomar <alx@kernel.org>
Date:   Sat Mar 16 13:35:02 2024 +0100

    [indxbib]: Clear `errno` before `strotol()` call.
    
    * src/utils/indxbib/indxbib.cpp (check_integer_arg): Clear `errno`
      before calling `strtol()`.  Otherwise, `errno` may hold `ERANGE` from
      before.  See strtol(3).
    
    Fixes: d7b36a45fc3f ("[indxbib]: Mitigate Savannah #65452.")
    Link: <https://savannah.gnu.org/bugs/?65452>
    Cc: "G. Branden Robinson" <branden@debian.org>
    Cc: Dave Kemper <saint.snit@gmail.com>
    Cc: "James K. Lowden" <jklowden@schemamania.org>
    Cc: Colin Watson <cjwatson@debian.org>
    Cc: Werner LEMBERG <wl@gnu.org>
    Cc: James Clark <jjc@jclark.com>
    Signed-off-by: Alejandro Colomar <alx@kernel.org>

commit 655ecf086142a676252a385c1c7a8be838ae9f3a
Author: Alejandro Colomar <alx@kernel.org>
Date:   Sat Mar 16 13:34:57 2024 +0100

    [indxbib]: Don't `else` after [[noreturn]].
    
    * src/utils/indxbib/indxbib.cpp (check_integer_arg): Don't `else` after
      [[noreturn]].
    
    Fixes: d7b36a45fc3f ("[indxbib]: Mitigate Savannah #65452.")
    Link: <https://savannah.gnu.org/bugs/?65452>
    Cc: "G. Branden Robinson" <branden@debian.org>
    Cc: Dave Kemper <saint.snit@gmail.com>
    Cc: "James K. Lowden" <jklowden@schemamania.org>
    Cc: Colin Watson <cjwatson@debian.org>
    Cc: Werner LEMBERG <wl@gnu.org>
    Cc: James Clark <jjc@jclark.com>
    Signed-off-by: Alejandro Colomar <alx@kernel.org>

commit 52dde3693d47d1484b4e95a96f181cff45a5dd5b
Author: Alejandro Colomar <alx@kernel.org>
Date:   Sat Mar 16 13:34:53 2024 +0100

    [libgroff,libbib,indxbib]: Add, use ceil_prime().
    
    * src/include/lib.h:
    * src/libs/libgroff/prime.cpp (ceil_prime): Add function to get the
      lowest prime not less than n.  While at it, fix the logic, which was
      incorrect in the open-coded call sites, since for an input of 1, it
      produced 3, but the first prime is 2.  A recent commit started
      rejecting 1 earlier, so this bug was now impossible to trigger, but
      remained there.
    
      Also, since this is a library function, let's behave well for an input
      of 0, which is mathematically fine, and return also the first prime,
      2.
    
    * src/libs/libbib/index.cpp (index_search_item::read_common_words_file):
    * src/utils/indxbib/indxbib.cpp (main): And use it where the same logic
      was being open-coded.
    
    Fixes: 4c7a3396375b ("[libbib, libgroff, indxbib]: Slightly refactor.")
    Link: <https://savannah.gnu.org/bugs/?65452>
    Link: <https://lists.gnu.org/archive/html/groff/2024-03/msg00065.html>
    Cc: "G. Branden Robinson" <branden@debian.org>
    Cc: Dave Kemper <saint.snit@gmail.com>
    Cc: "James K. Lowden" <jklowden@schemamania.org>
    Cc: Colin Watson <cjwatson@debian.org>
    Cc: Werner LEMBERG <wl@gnu.org>
    Cc: James Clark <jjc@jclark.com>
    Signed-off-by: Alejandro Colomar <alx@kernel.org>

commit 8c557db00ba1733b092807f16d0be988337d136b
Author: Alejandro Colomar <alx@kernel.org>
Date:   Sat Mar 16 13:34:48 2024 +0100

    [grolbp]: Remove bogus (and redundant) check.
    
    * src/devices/grolbp/lbp.cpp (main): Remove bogus (and redundant) check.
      `str == end` can only happen if strtol(3) returns 0.
    
    Fixes: 98608a8ba037 ("grolbp output device")
    Link: <https://savannah.gnu.org/bugs/?65451>
    Cc: "G. Branden Robinson" <branden@debian.org>
    Cc: Dave Kemper <saint.snit@gmail.com>
    Cc: "James K. Lowden" <jklowden@schemamania.org>
    Cc: Colin Watson <cjwatson@debian.org>
    Cc: Werner LEMBERG <wl@gnu.org>
    Cc: James Clark <jjc@jclark.com>
    Signed-off-by: Alejandro Colomar <alx@kernel.org>

commit 25afd0275a498ac4f3e02c7b045fe17ec774605b
Author: Alejandro Colomar <alx@kernel.org>
Date:   Sat Mar 16 13:34:43 2024 +0100

    src/: Remove redundant checks after strtol(3).
    
    src/devices/grodvi/dvi.cpp (dvi_font::handle_unknown_font_command):
    src/devices/grolbp/lbp.cpp (main):
    src/devices/grolj4/lj4.cpp (lj4_font::handle_unknown_font_command):
    src/devices/grolj4/lj4.cpp (main):
    src/devices/grops/ps.cpp (ps_printer::do_mdef, ps_printer::do_import):
    src/devices/grops/psrm.cpp (read_uint_arg):
    src/libs/libgroff/font.cpp (font::load):
    src/preproc/eqn/lex.cpp (do_space):
    src/preproc/pic/tex.cpp (tpic_output::command):
    src/preproc/refer/command.cpp (check_args):
    src/preproc/refer/ref.cpp (reference::compute_sort_key):
    src/preproc/refer/refer.cpp (main):
    src/utils/indxbib/indxbib.cpp (check_integer_arg):
    src/utils/lkbib/lkbib.cpp (main):
    src/utils/lookbib/lookbib.cpp (main):
    src/utils/tfmtodit/tfmtodit.cpp (main): Remove redundant checks after
    strtol(3).  `str == end` can only happen if strtol(3) returns 0.
    
    Fixes: 351da0dcdf70 ("groff before CVS: release 1.02")
    Fixes: d21a9dbc7a83 ("* src/devices/grolbp/lbp.cc: (long_options): Add
-w/--linewidth option.")
    Fixes: dc5351364982 ("groff before CVS: release 1.10")
    Link: <https://savannah.gnu.org/bugs/?65451>
    Cc: "G. Branden Robinson" <branden@debian.org>
    Cc: Dave Kemper <saint.snit@gmail.com>
    Cc: "James K. Lowden" <jklowden@schemamania.org>
    Cc: Colin Watson <cjwatson@debian.org>
    Cc: Werner LEMBERG <wl@gnu.org>
    Cc: James Clark <jjc@jclark.com>
    Signed-off-by: Alejandro Colomar <alx@kernel.org>

commit 52254689bc991cdf2f771740395e9035700cb36a
Author: Alejandro Colomar <alx@kernel.org>
Date:   Sat Mar 16 13:34:38 2024 +0100

    [libgroff]: Remove dead code from current_time().
    
    * src/libs/libgroff/curtime.cpp (current_time): Remove dead code.
      strtol(3) can only report ERANGE, if the base is valid (and it is).
    
    Fixes: e4290210f2c1 ("Implement `SOURCE_DATE_EPOCH' for reproducible
builds.")
    Link: <https://savannah.gnu.org/bugs/?65451>
    Cc: "G. Branden Robinson" <branden@debian.org>
    Cc: Dave Kemper <saint.snit@gmail.com>
    Cc: "James K. Lowden" <jklowden@schemamania.org>
    Cc: Colin Watson <cjwatson@debian.org>
    Cc: Werner LEMBERG <wl@gnu.org>
    Cc: James Clark <jjc@jclark.com>
    Signed-off-by: Alejandro Colomar <alx@kernel.org>

commit 43d928a97cf348ebece1ca79b9789d5777032b9f
Author: Alejandro Colomar <alx@kernel.org>
Date:   Sat Mar 16 13:34:33 2024 +0100

    [libgroff]: Drop some checks from current_time().
    
    * src/libs/libgroff/curtime.cpp (current_time): Remove redundant checks.
      ERANGE can only happen if strtol(3) returns either LONG_MIN or
      LONG_MAX.
    
    Fixes: e4290210f2c1 ("Implement `SOURCE_DATE_EPOCH' for reproducible
builds.")
    Link: <https://savannah.gnu.org/bugs/?65451>
    Cc: "G. Branden Robinson" <branden@debian.org>
    Cc: Dave Kemper <saint.snit@gmail.com>
    Cc: "James K. Lowden" <jklowden@schemamania.org>
    Cc: Colin Watson <cjwatson@debian.org>
    Cc: Werner LEMBERG <wl@gnu.org>
    Cc: James Clark <jjc@jclark.com>
    Signed-off-by: Alejandro Colomar <alx@kernel.org>




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65451>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]