unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: schwab@linux-m68k.org, emacs-devel@gnu.org
Subject: Re: Willing to debug bug #3542 (23.0.94; File access via UNC path slow again under Windows)
Date: Tue, 14 Jul 2009 06:18:32 +0300	[thread overview]
Message-ID: <83prc4q7ef.fsf@gnu.org> (raw)
In-Reply-To: <jwvocro9jbn.fsf-monnier+emacs@gnu.org>

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Andreas Schwab <schwab@linux-m68k.org>,  emacs-devel@gnu.org
> Date: Mon, 13 Jul 2009 20:54:14 -0400
> 
> > Aha.  But it sounds like it's not just me who is confused.  Here's
> > just two examples:
> 
> >   From doc.c:
> 
> >       strp = SDATA (string);
> >       while (strp < SDATA (string) + SBYTES (string))
> 
> >   (why not "while *strp"?)
> 
> As said Andreas, this would stop at the first NUL, which may appear
> within the string.

But then a gazillion other places are buggy: we _do_ use SDATA(str) as
a C string, and pass it to functions that will stop examining the
string on the first null.  A random example:

  d = opendir (SDATA (Fdirectory_file_name (encoded_dir)));

What am I missing?

> >   From fileio.c:
> >       nm = (unsigned char *) alloca (SBYTES (filename) + 1);
> >       bcopy (SDATA (filename), nm, SBYTES (filename) + 1);
> >   (why +1? it potentially accesses memory beyond end of `filename's
> >   contents)
> 
> The +1 is precisely used to make sure we copy the terminating NUL.

That's not my reading of allocate_string_data.  Are you sure?

Anyway, if that's true, then again we have bugs in other places.  Like
this one:

  directory_nbytes = SBYTES (directory);
  if (directory_nbytes == 0
      || !IS_ANY_SEP (SREF (directory, directory_nbytes - 1)))
    needsep = 1;
  [...]
		  int nbytes = len + directory_nbytes + needsep;
		  fullname = make_uninit_multibyte_string (nbytes, nbytes);
		  bcopy (SDATA (directory), SDATA (fullname),
			 directory_nbytes);




  reply	other threads:[~2009-07-14  3:18 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-05 21:01 Willing to debug bug #3542 (23.0.94; File access via UNC path slow again under Windows) Mathias Dahl
2009-07-05 22:58 ` Chong Yidong
2009-07-06 14:30   ` Mathias Dahl
2009-07-06 14:55     ` Chong Yidong
2009-07-07 11:00       ` Mathias Dahl
2009-07-07 11:14         ` Miles Bader
2009-07-06  3:06 ` Eli Zaretskii
2009-07-06  7:38   ` Mathias Dahl
2009-07-06 20:01     ` Eli Zaretskii
2009-07-08 15:01       ` Eli Zaretskii
2009-07-08 20:47         ` Mathias Dahl
2009-07-09 11:37           ` Jason Rumney
2009-07-09 11:53             ` Mathias Dahl
2009-07-09 16:11               ` Drew Adams
2009-07-09 16:25                 ` Jason Rumney
2009-07-09 17:03                   ` Drew Adams
2009-07-09 18:59                     ` Eli Zaretskii
2009-07-09 18:47                   ` Eli Zaretskii
2009-07-09 21:33                     ` Chong Yidong
2009-07-10  8:54                       ` Eli Zaretskii
2009-07-11 19:17                     ` Stefan Monnier
2009-07-11 20:22                       ` Eli Zaretskii
2009-07-13 12:17                         ` Stefan Monnier
2009-07-13 13:38                           ` Andreas Schwab
2009-07-13 19:00                             ` Eli Zaretskii
2009-07-13 18:56                           ` Eli Zaretskii
2009-07-14  0:51                             ` Stefan Monnier
2009-07-13 13:57                         ` Andreas Schwab
2009-07-13 19:02                           ` Eli Zaretskii
2009-07-13 19:39                             ` Andreas Schwab
2009-07-13 20:13                               ` Eli Zaretskii
2009-07-13 21:04                                 ` Andreas Schwab
2009-07-13 23:29                                   ` Chong Yidong
2009-07-14  0:31                                 ` YAMAMOTO Mitsuharu
2009-07-14  0:54                                 ` Stefan Monnier
2009-07-14  3:18                                   ` Eli Zaretskii [this message]
2009-07-14  4:28                                     ` Miles Bader
2009-07-14 19:14                                       ` Eli Zaretskii
2009-07-14 19:32                                         ` Davis Herring
2009-07-14 20:03                                           ` Eli Zaretskii
2009-07-14 20:27                                             ` Miles Bader
2009-07-14 21:05                                               ` Eli Zaretskii
2009-07-15  9:19                                           ` David Kastrup
2009-07-14  4:31                                     ` Haojun Bao
2009-07-14 18:18                                     ` Stefan Monnier
2009-07-14 19:57                                       ` Eli Zaretskii
2009-07-09 19:11                 ` Eli Zaretskii
2009-07-09 19:13               ` Eli Zaretskii
2009-07-09 12:56           ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83prc4q7ef.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=schwab@linux-m68k.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).