From: Xi Ruoyao <xry111@xry111.site>
To: James <tirtajames45@gmail.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] ftw.c: Check for "." and ".." branchlessly
Date: Sun, 24 Sep 2023 21:14:32 +0800 [thread overview]
Message-ID: <8624bcdd6d8f585e67b32f01dd6400b172768b1c.camel@xry111.site> (raw)
In-Reply-To: <CANDqPp0yVgx8hdeL9JUQgyMSww2MW7QDdPERC2Mxp5vdCOoOog@mail.gmail.com>
(Resend to fix the bad CC line.)
On Sun, 2023-09-24 at 19:49 +0700, James wrote:
> > No. The unaligned access will cause segmentation fault or bus error
> > on
> > some architectures.
> Won't fname be aligned since we're checking from the start of d_name?
>
> > 2. If "fname" is "..", then the bytes in "w4" can be:
> >
> > '.', '.', '\0', **anything**
> >
> > The last byte is completely arbitrary (and it may be even out of a
> > mapped memory range and then reading it will immediately cause a
> > segfault). Again I don't know if fname can be just ".." here
> > though.
> Doesn't the *(w4 *)fname | '\0' SH 24 overwrite the last arbitrary
> byte?
Alright, I misread it. But if the buffer is just 3-byte this is still
overreading the buffer and the overread may cause a segfault.
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
next parent reply other threads:[~2023-09-24 13:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CANDqPp0yVgx8hdeL9JUQgyMSww2MW7QDdPERC2Mxp5vdCOoOog@mail.gmail.com>
2023-09-24 13:14 ` Xi Ruoyao [this message]
2023-09-24 17:16 Wilco Dijkstra
2023-09-25 0:17 ` Paul Eggert
2023-09-25 6:26 ` Alexander Monakov
2023-09-25 6:45 ` Alexander Monakov
2023-09-25 7:10 ` Paul Eggert
2023-09-25 7:15 ` Andrew Pinski
2023-09-25 7:21 ` Andrew Pinski
2023-09-25 7:32 ` Paul Eggert
2023-09-25 7:32 ` Alexander Monakov
2023-09-25 8:10 ` Paul Eggert
-- strict thread matches above, loose matches on Subject: below --
2023-09-24 6:45 James Tirta Halim
2023-09-24 11:29 ` Xi Ruoyao
2023-09-24 11:43 ` Xi Ruoyao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8624bcdd6d8f585e67b32f01dd6400b172768b1c.camel@xry111.site \
--to=xry111@xry111.site \
--cc=libc-alpha@sourceware.org \
--cc=tirtajames45@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).