9front - general discussion about 9front
 help / color / mirror / Atom feed
From: boehm.igor@gmail.com
To: 9front@9front.org
Cc: boehm.igor@gmail.com
Subject: Re: [9front] drawterm: fix suicide caused by off-by-one write and out-of-bound read in libmemdraw/draw.c (patch)
Date: Sat, 06 Feb 2021 11:05:43 +0100	[thread overview]
Message-ID: <D383EF46640745E6129B36D77E1F8C7A@gmail.com> (raw)
In-Reply-To: <7D1FE3106BC07BB1AC2EC2F04FC1D349@eigenstate.org>

Quoth ori@eigenstate.org:
> Quoth boehm.igor@gmail.com:
> >  	for(i=0; i<dx; i++){
> > -		u = r[0] | (r[1]<<8) | (r[2]<<16) | (r[3]<<24);
> > +		for(j = 0, u = 0 ; j < 4 && r+j < end ; j++)
> > +			u |= r[j] << (8*j);
> > 
> 
> This fix seems wrong: 'u = ...' is loading a pixel. Why
> would we ever want to load *half* a pixel?
> 
> it seems like we either want to stop early, or ensure we
> allocate the right size image.

Thanks for reviewing Ori. Yeah, you are right.

Let me go back and study the code a bit more and try to come
up with something that is not a hack.


      reply	other threads:[~2021-02-06 10:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 21:19 boehm.igor
2021-02-05 21:18 ` ori
2021-02-06 10:05   ` boehm.igor [this message]

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=D383EF46640745E6129B36D77E1F8C7A@gmail.com \
    --to=boehm.igor@gmail.com \
    --cc=9front@9front.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;
as well as URLs for NNTP newsgroup(s).