From nobody Sun Mar 03 15:05:37 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 4TnlWP4JGCz5CxRy for ; Sun, 3 Mar 2024 15:05:37 +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 4TnlWP2dPvz4JL1 for ; Sun, 3 Mar 2024 15:05:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709478337; a=rsa-sha256; cv=none; b=Xtpg3FP2VHMIgHNqkdvxiMKmvAxkHWxS5NZsUJWGq0UQx3jUWAw8jCGXhMdXq6us2J9Mp/ NQsbgkXup8cvHORn6vFRR/jMD+tPoLmgAtdyf9/tULeHG2FJkpUdokditjWD6e+kNrDFkN LshSmXeStl6i3Sfeu+2tK6+ht1qEIR2Vw9G1xUxJ5ZYd9soV2KFDZSZe3j61N7T+aD4g7x ieZkPq0SF4Ke3E/AHTNn1SEF2K59pqFKRg1h/JL6+bKAGNBGUXozKpDaZQyemIA86OIj7z seA+uDSLdkHewhZtGrFFWL2wUPurOYV5s/2616tFqRN4/D28MFV6aQRDCJ2USw== 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=1709478337; 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=giAZILOxeKdhdQzpT8BUzT2Ivp/n3J3ZgJLhcOGVWy4=; b=KX60k68Rove3rG4ckcBh29Wvkt0Q0bhssoRKensHMR00BUtJH3jL6OuSiaJq0OYbXSAAsX rcUCNDhEFx6h768+riVcGdh4fNtcM/oii5761jNTDPOCD4rxklMZeBkkwZ44GAEUk08Td/ ikKPnw3L52qg7NR9JV5BHJ6+5Nau06psm2oFR+x/fAejeODI/x65IzNfHRCX5nyKBiqOlt qokdM9p9XV28XEYlH6OjBQLgEI9DKNhFVSVT8WxJ6dY6UwHvizXxm0GJ3F8+sHJxopIgqW MHD4hyFDepZSM1bX66sJcYyBlVqqgKKy3BYDOr/Me7C8YOX52/dEHY4i1syeSg== 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 4TnlWP2C9hzjyr for ; Sun, 3 Mar 2024 15:05:37 +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 423F5bSv035367 for ; Sun, 3 Mar 2024 15:05:37 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 423F5bYp035366 for bugs@FreeBSD.org; Sun, 3 Mar 2024 15:05:37 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 277454] bsdtar can dereference NULL from localtime() Date: Sun, 03 Mar 2024 15:05:37 +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 attachments.created 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=3D277454 Bug ID: 277454 Summary: bsdtar can dereference NULL from localtime() 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 Created attachment 248898 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D248898&action= =3Dedit a tar file that causes localtime() to return NULL In list_item_verbose() in src/contrib/libarchive/tar/util.c: ltime =3D localtime(&tim); strftime(tmp, sizeof(tmp), fmt, ltime); localtime() can return NULL, so there can be a crash in strftime(). I've attached a demo tar file: # uname -a FreeBSD stock14 15.0-CURRENT FreeBSD 15.0-CURRENT #18 main-n268497-3562b7b1eb80: Fri Feb 23 07:08:37 AST 2024=20=20=20=20 root@stock14:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 # tar tvf tar5a.img Program received signal SIGSEGV, Segmentation fault. Address not mapped to object. _fmt (format=3D0x10267ab "b %e %Y", t=3Dt@entry=3D0x0,=20 pt=3Dpt@entry=3D0x7fffffffe620 "0", ptlim=3Dptlim@entry=3D0x7fffffffe68= 4 "",=20 warnp=3Dwarnp@entry=3D0x7fffffffe59c,=20 loc=3Dloc@entry=3D0x80132e998 <__xlocale_global_locale>) at /usr/src/lib/libc/stdtime/strftime.c:152 152 pt =3D _add((t->tm_mon < 0 || (gdb) where #0 _fmt (format=3D0x10267ab "b %e %Y", t=3Dt@entry=3D0x0,=20 pt=3Dpt@entry=3D0x7fffffffe620 "0", ptlim=3Dptlim@entry=3D0x7fffffffe68= 4 "",=20 warnp=3Dwarnp@entry=3D0x7fffffffe59c,=20 loc=3Dloc@entry=3D0x80132e998 <__xlocale_global_locale>) at /usr/src/lib/libc/stdtime/strftime.c:152 #1 0x00000008012810fb in strftime_l (s=3D0x7fffffffe620 "0",=20 maxsize=3D, format=3D0x10267aa "%b %e %Y", t=3D0x0,=20 loc=3D0x80132e998 <__xlocale_global_locale>) at /usr/src/lib/libc/stdtime/strftime.c:84 #2 0x0000000801282616 in strftime ( s=3D0x62 ,=20 s@entry=3D0x7fffffffe620 "0", maxsize=3D0, maxsize@entry=3D100, format= =3D0x0,=20 format@entry=3D0x10267aa "%b %e %Y", t=3D0x7fffffffe601) at /usr/src/lib/libc/stdtime/strftime.c:111 #3 0x000000000102e1a9 in list_item_verbose ( bsdtar=3Dbsdtar@entry=3D0x7fffffffe7c8, out=3Dout@entry=3D0x80132f078,= =20 entry=3D0x801e45000) at /usr/src/contrib/libarchive/tar/util.c:752 #4 0x000000000102c09e in read_archive (bsdtar=3Dbsdtar@entry=3D0x7fffffffe= 7c8,=20 mode=3Dmode@entry=3D116 't', writer=3Dwriter@entry=3D0x0) at /usr/src/contrib/libarchive/tar/read.c:323 #5 0x000000000102bbee in tar_mode_t (bsdtar=3D0x62, bsdtar@entry=3D0x7ffff= fffe7c8) at /usr/src/contrib/libarchive/tar/read.c:94 #6 0x000000000102a665 in main (argc=3D, argv=3D) at /usr/src/contrib/libarchive/tar/bsdtar.c:942 --=20 You are receiving this mail because: You are the assignee for the bug.=