From nobody Fri Oct 14 00:40:08 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 4MpSGK1KwZz4f4y8 for ; Fri, 14 Oct 2022 00:40:09 +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 4MpSGJ6GS4z4Msc for ; Fri, 14 Oct 2022 00:40:08 +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 4MpSGJ58hSzbcS for ; Fri, 14 Oct 2022 00:40:08 +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 29E0e8Sj092662 for ; Fri, 14 Oct 2022 00:40:08 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 29E0e87l092661 for bugs@FreeBSD.org; Fri, 14 Oct 2022 00:40:08 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: Fri, 14 Oct 2022 00:40:08 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new 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: freebsd-bug-report-yf@yf.bsdclub.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: 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=1665708008; 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; bh=B4b41l2XhfQ6zLXmq2EPXeC2wGTWZfVYTzFP9iiMtEQ=; b=njA23ztVIw8rxJgG0APCLjCwumnEELJ931IMiZoD+TduCJkM3JKO/EAdlwVERnsrcvdSyA 5+RaOGJpDbOFs8mZVjzNSq5NX6iTFK265sOVAV1v3B8M3oiH+wRBqLPlVuKXAuYVv5VgMk EGHfB41wmRGoVqPQA7VcEj2Tlg4VK+0caatdhB5dMiE3dFPI7r2/G0ieObEmgBy6KH6bd0 fujqlN6gwAENdYSb3T4VlGkc85NzYMQgvJ1gNEifpN7X36QG08EReLpI4PbVuZK56o78sP pgrLI9S30Z9z+5rL6wZt3Usnl5YN2eqTpl+I97wd4h+jVQ4K2w7aNOqYgI1cWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665708008; a=rsa-sha256; cv=none; b=ElAVfrYojhKhRWIOAEiscPp1aHGXSFZW/IG8G9qxnYaSI+19aF69aYXd+rmmEko92ql8rr KoWVsdptRzqiJXXboC02jF12ck35C0Itwa4g2FOjOqPaxMVMs65O7bvFFIEFPBROMsQEuG B+BKPAEtoQWWBCVcxm6JOdwhZIEuU9Pb2ZrK7rqiVCpoZ4Du4j724brONFnNCwTwpCReYu Ld+vFdRYBOiXGfQZ9xtTBdP6kxRca8BXIknGo3RpbOVE8BIbQ4plSWhpvuQ5KCzvUfQ2eQ IS5I5tAFKAwWoKOCBv8DHIq/oFgWKZHLLIBy0FYFF2szDmviVFl5W3rb42Nc3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267032 Bug ID: 267032 Summary: diff(1) -U and -C with very large number of context may produce incorrect line indicator Product: Base System Version: 13.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: freebsd-bug-report-yf@yf.bsdclub.org diff(1) can accept number of context lines up to INT_MAX-1, however, it can cause signed integer overflow while calculating line number in line indicat= or. e.g. on FreeBSD/amd64, $ /usr/bin/diff -U2147483645 /usr/src/usr.bin/diff/diff.h /usr/src/usr.bin/diff/diff.c | /usr/bin/grep '^@@' @@ -1,117 +1,659 @@ @@ --2147483646,0 +-2147483647,0 @@ @@ --2147483634,0 +-2147483643,0 @@ @@ --2147483622,0 +-2147483635,0 @@ @@ --2147483619,0 +-2147483631,0 @@ @@ --2147483616,0 +-2147483627,0 @@ @@ --2147483613,0 +-2147483625,0 @@ @@ --2147483598,0 +-2147483615,0 @@ @@ --2147483596,0 +-2147483612,0 @@ @@ --2147483595,0 +-2147483597,0 @@ @@ --2147483588,0 +-2147483581,0 @@ @@ --2147483574,0 +-2147483535,0 @@ @@ --2147483573,0 +-2147483167,0 @@ @@ --2147483571,0 +-2147483165,0 @@ @@ --2147483562,0 +-2147483158,0 @@ @@ --2147483561,0 +-2147483142,0 @@ @@ --2147483559,0 +-2147483140,0 @@ @@ --2147483555,0 +-2147483135,0 @@ @@ --2147483550,0 +-2147483129,0 @@ @@ --2147483538,0 +-2147483124,0 @@ @@ --2147483534,0 +-2147482992,0 @@ I tried it on FreeBSD/amd64 13.0-RELEASE, with diff built from source broug= ht from commit 3736b2dd327050d2e6c925964b210eccbaac51ab in main branch. --=20 You are receiving this mail because: You are the assignee for the bug.=