From nobody Fri May 31 09:31:48 2024 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 4VrHv9238lz5MYDf for ; Fri, 31 May 2024 09:31:49 +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 4VrHv86h6Tz4WjL for ; Fri, 31 May 2024 09:31:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717147908; a=rsa-sha256; cv=none; b=p6w2a5NRGL8k+4jc5u+3Q9Ht5AtYfZl/bN0nA6n1rZxsw8d77ovEpJD7c7HmKCQvPZwuZQ Mp11lNYp7k+XxDH/sUKsZrmUHjX5aa59OzlkRnWiTHqQTo4e8/+BQhd6W1Efj/bjjKrUtQ 77AypIrJsng+ClpCeMu8KnyKsb1I4Dh6etlJtV8noUtY4jA48qJ/Iuj+C0RPdRsF0UwMmL cm0gh3T8hWQnPlfFFZfak9S7LqvpDkFeqCYY5/mHX7dGsAfiDc+ZgbAf8R76skCmx45xAQ BmNvwfOlAdEkMj8frFCx9qn6tjMri68sP6vaCiD0BbXpEDBItr4DFwgWjEvcQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717147908; 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=XRRIeVEhg37ew3bk89hPf3YAYSA+0MqaxUGTGHb7u/0=; b=rgiDU+2G72VhYwSOFSofHbNljssqfDw9sJ0H5krGixAcuuEOqBKYlzbQT0rzGCeHiTBwZw spBfFbd4YbUKAySUa/iXvECcmztSv8xHd5iV9Ix6HRjc1Y/lITGhScbU8mt/BJjt/3dmiY H9FgU+O9WQH3eP7afBFdCE3AD0gutDTcjqnPpPKWeOmFQcy1gLR8KIBpvQVOkZYjqqtcaw rc/FcZXJYf5M3xSTCPgmxUFz08EhD1KFtKN2Dk5Ae0nyF11I1dkG0/fR3MnTBQKhe9yMf7 KZQ6wSiN5gZa+1V1qqexo8Z/klRKptx+/rUSLECk1NGpw7rSkYYNhIOax1qHow== 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 4VrHv86J2pzJZ4 for ; Fri, 31 May 2024 09:31:48 +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 44V9Vmds013543 for ; Fri, 31 May 2024 09:31:48 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 44V9VmOF013542 for bugs@FreeBSD.org; Fri, 31 May 2024 09:31:48 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 279426] ^R ^W can cause libedit to read before the start of a buffer Date: Fri, 31 May 2024 09:31:48 +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: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: rtm@lcs.mit.edu 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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D279426 Bug ID: 279426 Summary: ^R ^W can cause libedit to read before the start of a buffer Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu If I run valgrind on /bin/sh or other programs that use libedit, and type ^R ^W at the start of a line, valgrind complains: Invalid read of size 4 at 0x4873B3B: c__next_word (rtm/freebsd/contrib/libedit/chared.c:266) by 0x4892E7D: ce_inc_search (rtm/freebsd/contrib/libedit/search.c:300) by 0x487C25B: em_inc_search_prev (rtm/freebsd/contrib/libedit/emacs.c:= 488) by 0x4889747: el_wgets (rtm/freebsd/contrib/libedit/read.c:540) by 0x4879B3C: el_gets (rtm/freebsd/contrib/libedit/eln.c:75) by 0x123D6E: preadfd (rtm/freebsd/bin/sh/input.c:138) by 0x12387A: preadbuffer (rtm/freebsd/bin/sh/input.c:210) by 0x1326C5: xxreadtoken (rtm/freebsd/bin/sh/parser.c:910) by 0x12E4FC: readtoken (rtm/freebsd/bin/sh/parser.c:827) by 0x12E379: parsecmd (rtm/freebsd/bin/sh/parser.c:222) by 0x129786: cmdloop (rtm/freebsd/bin/sh/main.c:206) by 0x1295D2: main (rtm/freebsd/bin/sh/main.c:167) Address 0x553329c is 4 bytes before a block of size 4,096 alloc'd at 0x4851735: calloc (vg_replace_malloc.c:1599) by 0x48740AA: ch_init (rtm/freebsd/contrib/libedit/chared.c:399) by 0x4877714: el_init_internal (rtm/freebsd/contrib/libedit/el.c:107) by 0x48775B0: el_init_fd (rtm/freebsd/contrib/libedit/el.c:124) by 0x487754A: el_init (rtm/freebsd/contrib/libedit/el.c:66) by 0x1215BC: histedit (rtm/freebsd/bin/sh/histedit.c:183) by 0x12C1ED: optschanged (rtm/freebsd/bin/sh/options.c:130) by 0x12BEA1: procargs (rtm/freebsd/bin/sh/options.c:121) by 0x1293EC: main (rtm/freebsd/bin/sh/main.c:131) Perhaps this can be fixed by adding this after line 297 of search.c: if(el->el_line.cursor =3D=3D el->el_line.buffer) break; FreeBSD stock14 15.0-CURRENT FreeBSD 15.0-CURRENT #22 main-n270479-ecd1d1f1dac4-dirty: Thu May 30 18:42:11 AST 2024=20=20=20=20 root@stock14:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 --=20 You are receiving this mail because: You are the assignee for the bug.=