]> git.puffer.fish Git - matthieu/frr.git/commitdiff
suppress some more expected unsigned wraps
authorQuentin Young <qlyoung@nvidia.com>
Tue, 8 Sep 2020 15:07:23 +0000 (11:07 -0400)
committerQuentin Young <qlyoung@nvidia.com>
Mon, 15 Nov 2021 22:12:33 +0000 (17:12 -0500)
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
lib/printf/vfprintf.c
ospfd/ospf_lsa.c

index ef1d5e0eef1643ec3645cb244d4b9e9b2644f43e..175bdaf36a774d6b56e90cd2af0f67d9866af096 100644 (file)
@@ -146,8 +146,8 @@ __wcsconv(wchar_t *wcsarg, int prec)
 /*
  * Non-MT-safe version
  */
-ssize_t
-vbprintfrr(struct fbuf *cb_in, const char *fmt0, va_list ap)
+ssize_t vbprintfrr(struct fbuf *cb_in, const char *fmt0, va_list ap)
+       __attribute__((no_sanitize("unsigned-integer-overflow")))
 {
        const char *fmt;        /* format string */
        int ch;                 /* character from fmt */
@@ -483,7 +483,7 @@ reswitch:   switch (ch) {
                                }
                        } else {
                                if ((long)ulval < 0) {
-                                       ulval = (u_long)-ulval;
+                                       ulval = (~ulval) + 1;
                                        sign = '-';
                                }
                        }
index 10541b09bb8941452cfd20da31d3431b3fd685ed..16aa74d915050f1e460eb299d528259fec1bd1f9 100644 (file)
@@ -2716,7 +2716,8 @@ struct ospf_lsa *ospf_lsa_install(struct ospf *ospf, struct ospf_interface *oi,
            can be originated. "
         */
 
-       if (ntohl(lsa->data->ls_seqnum) - 1 == OSPF_MAX_SEQUENCE_NUMBER) {
+       if (ntohl(lsa->data->ls_seqnum) != 0
+           && ntohl(lsa->data->ls_seqnum) - 1 == OSPF_MAX_SEQUENCE_NUMBER) {
                if (ospf_lsa_is_self_originated(ospf, lsa)) {
                        lsa->data->ls_seqnum = htonl(OSPF_MAX_SEQUENCE_NUMBER);