From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13357 invoked from network); 28 Dec 2022 11:32:20 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 28 Dec 2022 11:32:20 -0000 Received: (qmail 25879 invoked by uid 550); 28 Dec 2022 11:32:16 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 25842 invoked from network); 28 Dec 2022 11:32:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=compiler-ai.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=lJaMtRq9KcnLaFUbJbSBfZtAP5bYAMOPqpdPx2ZXgGw=; b=ksDtg5bxooTDhg1yTbsDL7rToXxkRaxY5+j+EZYCnJx0po63q4IPq9gPBo9OnW6P3P O18duQklmhmmaEmLhI1GSMfEXB+BoB92YGT7GsLDx15hmVVIvPfdU6SqhL92tLEXM/jc 3onQYbajyBlKxdAC+gtHElXgnoa1qtDrf7hVwut4CKcfpXaomJTCsfZdSc75znuNuDjk QH3eNC9thwJjFoq6LDggp0D+4MIyqh/T6fqiFQ4CS3C8V1fNwt/otlyRZsDVSLn+YSYx M2aaCIj1BCNdnFW76Sq4bxpbyOH/PHgZX2kOR6mRHCfjP/nXWfw0TNtrvECTYE4Hscah /sfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lJaMtRq9KcnLaFUbJbSBfZtAP5bYAMOPqpdPx2ZXgGw=; b=hpDL8ULVRgQR9P/3O3Y7hzOoSFPvpiRyACMhP4DNEFyW1cyy4U14BKuuYrue0atzSg jryAj5bKl6qEzWUX28SXmB1aZm/ptCqSPkqGk+TykI2lkedcyWdO5bWSVFq0EOWBcfPL qRm2DxFb6RnVNnEUqlOv0AB3rIcBPxf2ZSVji2yV7YjxjZAC16L1yTcNgRYf7oJgRCnm aVHjyYfF9SupczRzmnYHc2T3z/1V9AGNp7Dgh7QkN3Iw5fEGZpxYVkgtr38MMngVGFJF 5dTm0v80ZdpftH/hpq8aBIKz8EQpydUMNDcUsrfI7vknNVH1ABLoGsE7TQlX2vBxXYGi 5MeA== X-Gm-Message-State: AFqh2krwkA8s/75ShzoUjGqbCdvn9s9FV0igc255PQzUw6uQc+T4uuvC X3R+zo6HiarvMdXBYZeNtELg/AQMcHZUUOR+nG5aaeMDEigojehU X-Google-Smtp-Source: AMrXdXsLhaUlGmjltT8c7ZwzdxECgnMAS6/jHukUpbaqA1LUEI6cf0y81axkRqXEgALo3g3Sitjvut1vaZUGUUCmy2I= X-Received: by 2002:a17:906:1153:b0:7ff:796b:93ee with SMTP id i19-20020a170906115300b007ff796b93eemr2955580eja.582.1672227123684; Wed, 28 Dec 2022 03:32:03 -0800 (PST) MIME-Version: 1.0 From: Bugs Reporter Date: Wed, 28 Dec 2022 17:01:53 +0530 Message-ID: To: musl@lists.openwall.com Cc: sbansal@iitd.ac.in, shubhani@sit.iitd.ac.in, abhishek.rose@cse.iitd.ac.in, Jai.Arora.cs518@cse.iitd.ac.in Content-Type: multipart/alternative; boundary="000000000000b0fc3305f0e1b7fc" Subject: [musl] Bug in swab --000000000000b0fc3305f0e1b7fc Content-Type: text/plain; charset="UTF-8" Hi, I am writing to report a bug in the swab function of musl. The bug is in the C implementation of swab as located in the src/string directory of the musl repository. The musl version was `1.2.3` and the source code was downloaded from the latest release on the official website. Please find a detailed report below. Linux[0] manpage for swab() specifies that the function copies n bytes from the array pointed to by from to the array pointed to by to, exchanging adjacent even and odd bytes. This should also work for coinciding memories and musl's implementation does not take that into account. An example input is: char src[] = {65, 64}; void* dst = src; swab(src, dst, 2); if (src[0] != 64 || src[1] != 65) { printf("BUG!\n"); } The file that demonstrates the bug can be found here . A patch that applies the necessary fix is available here . 0: https://man7.org/linux/man-pages/man3/swab.3.html Thanks, Jai Arora, Abhishek Rose, Shubhani Gupta, Sorav Bansal CompilerAI Research Group IIT Delhi, India --000000000000b0fc3305f0e1b7fc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I am writing to report a bug in the swab functi= on of musl.
The bug is in the C implementation of swab as located in the= src/string directory of the musl repository. The musl version was `1.2.3` = and the source code was downloaded from the latest release on the o= fficial website.
Please find a detailed report below.

Linux[0] ma= npage for swab() specifies that the function copies n bytes from the array = pointed to by from to the array pointed to by to, exchanging adjacent even = and odd bytes. This should also work for coinciding memories and musl's= implementation does not take that into account.
An example input is:=C2=A0 =C2=A0 char src[] =3D {65, 64};
=C2=A0 =C2=A0 void* dst =3D src;=
=C2=A0 =C2=A0 swab(src, dst, 2);
=C2=A0 =C2=A0 if (src[0] !=3D 64 ||= src[1] !=3D 65) {
=C2=A0 =C2=A0 =C2=A0 printf("BUG!\n");
= =C2=A0 =C2=A0 }

The file that demonstrates the bug can be found here.
A patch that applies the necess= ary fix is available here.

0: https://man7.org/linux/man-pages/man3/swab.3.html

Thanks,
<= br>Jai Arora, Abhishek Rose, Shubhani Gupta, Sorav Bansal
CompilerAI Res= earch Group
IIT Delhi, India
--000000000000b0fc3305f0e1b7fc--