unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* problem report #101
@ 2008-12-01 16:59 Dan Nicolaescu
  2008-12-01 18:11 ` Andreas Schwab
  2008-12-02  2:16 ` Kenichi Handa
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Nicolaescu @ 2008-12-01 16:59 UTC (permalink / raw)
  To: emacs-devel

CID: 101
Checker: FORWARD_NULL (help)
File: base/src/emacs/src/font.c
Function: font_at
Description: Variable "face" tracked as NULL was passed to a function that dereferences it.


Event var_compare_op: Added "face" due to comparison "face == 0"
Also see events: [var_deref_op][var_deref_model]
At conditional (1): "face == 0" taking true path

3631 	  if (! face)
3632 	    {
3633 	      int face_id;
3634 	      EMACS_INT endptr;
3635 	

At conditional (2): "string & 7 == 3" taking true path

3636 	      if (STRINGP (string))
3637 		face_id = face_at_string_position (w, string, pos, 0, -1, -1, &endptr,
3638 						   DEFAULT_FACE_ID, 0);
3639 	      else
3640 		face_id = face_at_buffer_position (w, pos, -1, -1, &endptr,
3641 						   pos + 100, 0);

At conditional (3): "face_id < ((f)->face_cache)->used" taking false path

3642 	      face = FACE_FROM_ID (f, face_id);
3643 	    }

At conditional (4): "multibyte != 0" taking true path

3644 	  if (multibyte)
3645 	    {

Event var_deref_op: Variable "face" tracked as NULL was dereferenced.
Event var_deref_model: Variable "face" tracked as NULL was passed to a function that dereferences it. [model]
Also see events: [var_compare_op][var_deref_model]
At conditional (5): "c < 128" taking true path

3646 	      int face_id = FACE_FOR_CHAR (f, face, c, pos, string);
3647 	      face = FACE_FROM_ID (f, face_id);
3648 	    }




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem report #101
  2008-12-01 16:59 problem report #101 Dan Nicolaescu
@ 2008-12-01 18:11 ` Andreas Schwab
  2008-12-02  2:16 ` Kenichi Handa
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2008-12-01 18:11 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

Dan Nicolaescu <dann@ics.uci.edu> writes:

> 3636 	      if (STRINGP (string))
> 3637 		face_id = face_at_string_position (w, string, pos, 0, -1, -1, &endptr,
> 3638 						   DEFAULT_FACE_ID, 0);
> 3639 	      else
> 3640 		face_id = face_at_buffer_position (w, pos, -1, -1, &endptr,
> 3641 						   pos + 100, 0);
>
> At conditional (3): "face_id < ((f)->face_cache)->used" taking false path
>
> 3642 	      face = FACE_FROM_ID (f, face_id);

face_id is always valid here.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem report #101
  2008-12-01 16:59 problem report #101 Dan Nicolaescu
  2008-12-01 18:11 ` Andreas Schwab
@ 2008-12-02  2:16 ` Kenichi Handa
  2008-12-02  2:24   ` Kenichi Handa
  1 sibling, 1 reply; 4+ messages in thread
From: Kenichi Handa @ 2008-12-02  2:16 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

In article <200812011659.mB1GxPZD015344@mothra.ics.uci.edu>, Dan Nicolaescu <dann@ics.uci.edu> writes:

> CID: 101
> Checker: FORWARD_NULL (help)
> File: base/src/emacs/src/font.c
> Function: font_at
> Description: Variable "face" tracked as NULL was passed to a function that dereferences it.

[...]
> Event var_deref_op: Variable "face" tracked as NULL was dereferenced.
> Event var_deref_model: Variable "face" tracked as NULL was passed to a function that dereferences it. [model]
> Also see events: [var_compare_op][var_deref_model]
> At conditional (5): "c < 128" taking true path

> 3646 	      int face_id = FACE_FOR_CHAR (f, face, c, pos, string);
> 3647 	      face = FACE_FROM_ID (f, face_id);
> 3648 	    }

Here, "face" is a return value of
face_at_string/buffer_position, and thus is never NULL.
Which do you think is better; ignore this waring or use a
new macro FACE_FROM_ID_NO_CHECK instead of FACE_FROM_ID?

/* Like FACE_FROM_ID but don't check the validity of ID.  */

#define FACE_FROM_ID_NO_CHECK(F, ID)	\
  (FRAME_FACE_CACHE (F)->faces_by_id[ID])

---
Kenichi Handa
handa@ni.aist.go.jp




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem report #101
  2008-12-02  2:16 ` Kenichi Handa
@ 2008-12-02  2:24   ` Kenichi Handa
  0 siblings, 0 replies; 4+ messages in thread
From: Kenichi Handa @ 2008-12-02  2:24 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: dann, emacs-devel

In article <E1L7Kny-00064v-Ag@etlken.m17n.org>, Kenichi Handa <handa@m17n.org> writes:

> Here, "face" is a return value of

Oops, please read "face" as "face_id".

> face_at_string/buffer_position, and thus is never NULL.
> Which do you think is better; ignore this waring or use a
> new macro FACE_FROM_ID_NO_CHECK instead of FACE_FROM_ID?

> /* Like FACE_FROM_ID but don't check the validity of ID.  */

> #define FACE_FROM_ID_NO_CHECK(F, ID)	\
>   (FRAME_FACE_CACHE (F)->faces_by_id[ID])

> ---
> Kenichi Handa
> handa@ni.aist.go.jp







^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-02  2:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-01 16:59 problem report #101 Dan Nicolaescu
2008-12-01 18:11 ` Andreas Schwab
2008-12-02  2:16 ` Kenichi Handa
2008-12-02  2:24   ` Kenichi Handa

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).