GNU bug report logs - #3605
Crash in ns_index_color (nsterm.m:1305)

Previous Next

Packages: ns, emacs;

Reported by: David Reitter <david.reitter <at> gmail.com>

Date: Thu, 18 Jun 2009 15:05:04 UTC

Severity: normal

Merged with 3606, 4530, 4532

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #27 received at 3605 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: David Reitter <david.reitter <at> gmail.com>
To: Adrian Robert <adrian.b.robert <at> gmail.com>
Cc: 3605 <at> debbugs.gnu.org, Ben Lowery <blowery <at> gmail.com>
Subject: Re: Crash in ns_index_color (nsterm.m:1305)
Date: Thu, 23 Jul 2009 16:16:26 +0100
[Message part 1 (text/plain, inline)]
On Jul 23, 2009, at 3:46 PM, Adrian Robert wrote:
>
> If you could please retest this against the latest branch or trunk,  
> I've checked in some robustness improvement to the indexed color  
> stuff that may clear this up.

Further to that, I don't think your change is as safe as it could be.
Below is what I did in Aquamacs:master:  I'm returning an actual color  
in case the index is invalid, rather than nil.
Is ns_lookup_indexed_color() generally expected to return nil if  
something goes wrong?  It's cleaner than returning something random,  
but it'll still lead to an error if unchecked.

- D

<<<<<<< HEAD:src/nsterm.m

  /* for some reason, idx is 0 for undefined colors.
     Also, this function is called with very high indices at times
     (XXX: debug this.) */
  if (idx > 0 && idx < color_table->size
      && ![color_table->empty_indices containsObject: [NSNumber  
numberWithUnsignedInt: idx]])
    {
      /* fprintf(stderr, "lookup color %d\n", idx); */
      return color_table->colors[idx];
    }
  /* fprintf(stderr, "DISCARDING lookup color %d\n", idx); */
  return [NSColor orangeColor];  // mark undefined color
=======
  if (idx < 1 || idx >= color_table->avail)
    return nil;
  return color_table->colors[idx];
>>>>>>> emacs23.1:src/nsterm.m
[smime.p7s (application/pkcs7-signature, attachment)]

This bug report was last modified 12 years and 346 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.