mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: segfault on sscanf
Date: Thu, 14 Mar 2019 18:34:15 -0400	[thread overview]
Message-ID: <20190314223415.GH23599@brightrain.aerifal.cx> (raw)
In-Reply-To: <20190314194933.GK26605@port70.net>

On Thu, Mar 14, 2019 at 08:49:34PM +0100, Szabolcs Nagy wrote:
> * Markus Wichmann <nullplan@gmx.net> [2019-03-14 19:38:12 +0100]:
> 
> > On Thu, Mar 14, 2019 at 07:19:19PM +0100, Szabolcs Nagy wrote:
> > > i think __shgetc should ensure f->rpos == f->shend on EOF
> > 
> > What about shunget(), though? Currently, if shgetc() returns EOF, at the
> 
> i meant f->rpos == f->shend == 0.

Changing f->rpos is not valid here; it would corrupt the state of the
FILE for furher use after the shgetc phase is done. This is especially
important if we reached the code due to shlim being hit, but I think
it also matters for __uflow failing; normally the FILE is left in read
mode, with rpos and rend pointers valid. If we were going to zero
rpos, we would also have to zero rend, taking it out of read mode, but
this does not seem desirable.

Rather, I think f->shend should be set to f->rpos, not 0. Does this
sound right?

Rich


  parent reply	other threads:[~2019-03-14 22:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14  9:46 Marian Buschsieweke
2019-03-14 12:44 ` A. Wilcox
2019-03-14 13:29   ` Szabolcs Nagy
2019-03-14 14:34     ` Pascal Cuoq
2019-03-14 16:28 ` Markus Wichmann
2019-03-14 16:53   ` Markus Wichmann
2019-03-14 18:19     ` Szabolcs Nagy
2019-03-14 18:38       ` Markus Wichmann
2019-03-14 19:49         ` Szabolcs Nagy
2019-03-14 20:15           ` Szabolcs Nagy
2019-03-14 22:34           ` Rich Felker [this message]
2019-03-14 22:43             ` Szabolcs Nagy
2019-03-14 22:52               ` Rich Felker
2019-03-15  1:54                 ` Rich Felker
2019-03-14 22:40   ` Rich Felker

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=20190314223415.GH23599@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).