From: Chong Yidong <cyd@stupidchicken.com>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: emacs-pretest-bug@gnu.org
Subject: Re: memory corruption in regex.c
Date: Sat, 22 Mar 2008 17:34:05 -0400 [thread overview]
Message-ID: <87abkqo33m.fsf@stupidchicken.com> (raw)
In-Reply-To: <200803221125.m2MBPZ7q021670@livre.oliva.athome.lsd.ic.unicamp.br> (Alexandre Oliva's message of "Sat\, 22 Mar 2008 08\:25\:35 -0300")
Alexandre Oliva <aoliva@redhat.com> writes:
> https://bugzilla.redhat.com/show_bug.cgi?id=435767
>
> emacs invokes undefined behavior in regex.c, computing the difference
> between unrelated pointers. In general, this wouldn't be too much of
> a problem, as long as the type used to represent the difference was
> wide enough to cover the entire possible range of pointer differences.
>
> Such a type is not even guaranteed to exist, and it can be tricky to
> get reasonable results on segmented architectures. So, the correct
> code needs to compute offsets between pointers in the old buffer, and
> apply the same offset into the new buffer. On most cases, the
> compiler will just optimize the code to the same we got before on
> i386, and to something very close, but using a 64-bit offset on
> x86-64.
This sounds correct. Thanks very much for catching this bug. I don't
see any problem with your patch, except:
> - re_char *old_buffer = bufp->buffer; \
> + unsigned char *old_buffer = bufp->buffer; \
What is the purpose of this?
next prev parent reply other threads:[~2008-03-22 21:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-22 11:25 memory corruption in regex.c Alexandre Oliva
2008-03-22 21:34 ` Chong Yidong [this message]
2008-03-23 4:04 ` Alexandre Oliva
2008-03-26 22:51 ` Chong Yidong
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=87abkqo33m.fsf@stupidchicken.com \
--to=cyd@stupidchicken.com \
--cc=aoliva@redhat.com \
--cc=emacs-pretest-bug@gnu.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.