public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dave@treblig.org>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org, rleigh@debian.org
Subject: Re: [PATCH] get_line fixes for wide characters and overflows
Date: Sat, 3 Aug 2013 13:38:30 +0100	[thread overview]
Message-ID: <20130803123830.GB5098@gallifrey> (raw)
In-Reply-To: <20130801140407.GC2484@x2.net.home>

* Karel Zak (kzak@redhat.com) wrote:
> On Thu, Aug 01, 2013 at 01:57:03PM +0100, Dr. David Alan Gilbert wrote:
> > e to
> > >  reproduce the problem with the file from Suse bugzilla).
> > 
> > Hi Karel,
> >   Thanks for the reply.  I'll give it a go over the weekend,
> > but I don't think it can handle the wchar problems I described and fixed
> > in my follow up patch. If a 4byte wchar hapens to land at the end of the buffer
> > how do you guarantee the space?
> 
>  Ah, I probably see what you mean. So I have added p < &Line[LineLen - 1]
>  check to the for() where the code copies the multibyte buffer to line buffer.
>  See git tree for more details.

OK; so I think with your ...ea608842 change then it should work (not tried
to push it); but with that change hopefully the extra check in ..623bc74f
should never trigger; which is good because if it does then I think you'll
end up outputing part of a wide character which would get messy.

One thing I tried to do in my change was remove the magic '4's that
pop up in a few places because of the wide characters.

(Any particular reason you prefered this over my fix?)

Dave

> 
>     Karel
> 
> 
> 
> -- 
>  Karel Zak  <kzak@redhat.com>
>  http://karelzak.blogspot.com
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\ gro.gilbert @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

  reply	other threads:[~2013-08-03 12:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16 23:20 a repeatable 'more' crash and question about wide char and 'get_line' safety Dr. David Alan Gilbert
2013-07-19 22:35 ` [PATCH] get_line fixes for wide characters and overflows Dr. David Alan Gilbert
2013-08-01 11:01   ` Karel Zak
2013-08-01 12:57     ` Dr. David Alan Gilbert
2013-08-01 14:04       ` Karel Zak
2013-08-03 12:38         ` Dr. David Alan Gilbert [this message]
2013-08-05  8:40           ` Karel Zak

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=20130803123830.GB5098@gallifrey \
    --to=dave@treblig.org \
    --cc=kzak@redhat.com \
    --cc=rleigh@debian.org \
    --cc=util-linux@vger.kernel.org \
    /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