9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Cc: 9front@9front.org
Subject: Re: [9front] drawterm: fix suicide caused by off-by-one write and out-of-bound read in libmemdraw/draw.c (patch)
Date: Fri, 05 Feb 2021 13:18:37 -0800	[thread overview]
Message-ID: <7D1FE3106BC07BB1AC2EC2F04FC1D349@eigenstate.org> (raw)
In-Reply-To: <66A85B05FD8A4DCC2FBCCBC6BC5F9FFB@gmail.com>

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.


  reply	other threads:[~2021-02-06  2:45 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 [this message]
2021-02-06 10:05   ` boehm.igor

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=7D1FE3106BC07BB1AC2EC2F04FC1D349@eigenstate.org \
    --to=ori@eigenstate.org \
    --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).