From nobody Sat Oct 15 09:54:51 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MqJWx4r61z4fDH2 for ; Sat, 15 Oct 2022 09:54:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MqJWx3hylz3Nx8 for ; Sat, 15 Oct 2022 09:54:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MqJWx2ZV6z14yF for ; Sat, 15 Oct 2022 09:54:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 29F9srdu023134 for ; Sat, 15 Oct 2022 09:54:53 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 29F9sroV023133 for bugs@FreeBSD.org; Sat, 15 Oct 2022 09:54:53 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 267032] diff(1) -U and -C with very large number of context may produce incorrect line indicator Date: Sat, 15 Oct 2022 09:54:51 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: tamelingdaniel@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665827693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PGPDS8QWa3WoFPW0nncAQG801vElxyTCsFIFRkNlz2I=; b=nAC8MAhe9nrEZmRpu4bRQi4BbzyLTFOzOD8/HRUnowBKWg38xsZpLWY8fWqHGl525syeOR 9jwF0vK8UrFXyazDAkiYD2CTsn75Stl7S/9KHsnf6MSIN9+ikyX84O0Dtp8mJFz1CEyMXu XXPH9Uo0IRjNB3f0Y5trT1KXorcI7GrdRsJ891YAImzWKXylJwj03g1V/aJp4hA/w3gGBV kl+lKVLFErcR9x9x+m9ZPm4MFff8sCje91TvAMqEcN9wT5hk9g28JZOZ+axIan9Jz/Ls8w XIMitx1DVLBlU4yOdEg0YpQYfjJkWw78+FLt63mSo0tDVVcFGStAIgJd4mViRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665827693; a=rsa-sha256; cv=none; b=Ta++YwPudrHDYHNetJywfk6SmKYKVFudOuKUqiIX1ZBFnn1A7cpl2U+89zs7N18aMJ0CMc CP96z9AKzV/y5LD6GBtuUgy/04umIDJg2ihmOn40RJo61gjERJiWDHTGYmdfuJ205H/xwr z2mLe94xbNu9aeiL/KYleSX+O4z//kMnH50t3Cpno4M+av8zh/qinI12JAWGqxgZbkkfoz rBj3JrZbQpOVQsalzH+RMT3KhWI+Je6QCA47NuPDZ/JlcsMMnFD2ViNDQpXNV6BhctIJUj x9/0sr1vXA5Rzz61NKFp1AnyeM5UIl0kMCZ3mxEOr4AtxMSkMrZyMumLoMVQtw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267032 Daniel Tameling changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tamelingdaniel@gmail.com --- Comment #1 from Daniel Tameling --- I had a look at this and there are two kinds of overflows that happen. The first is for the line number. Here the code does something like upd =3D MIN(len[1], context_vec_ptr->d + diff_context); where the addition can overflow. The fix is to just use len[1] if that would happen. The second overflow happens when checking whether the current chuck overlaps with the next one. This is why the command you posted has so much output; it should just be one large chunk. The code of the check is } else if (a > context_vec_ptr->b + (2 * diff_context) + 1 && c > context_vec_ptr->d + (2 * diff_context) + 1) { To fix this one should check if an overflow would happen and if that is the case to not execute the body of the else if. --=20 You are receiving this mail because: You are the assignee for the bug.=