unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Problem report #17
@ 2006-04-10 18:50 Dan Nicolaescu
  2006-05-11  5:10 ` Dan Nicolaescu
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Nicolaescu @ 2006-04-10 18:50 UTC (permalink / raw)


CID: 17
Checker: FORWARD_NULL (help)
File: emacs/src/xfaces.c
Function: best_matching_font
Description: Variable "best" tracked as NULL was dereferenced.

Event var_compare_op: Added "best" due to comparison "best != 0"
Also see events: [var_deref_op]
At conditional (1): "best != 0" taking false path

6666 	      if (best && best->numeric[XLFD_POINT_SIZE] == pt)
6667 		non_scalable_has_exact_height_p = 1;
6668 	      else
6669 		non_scalable_has_exact_height_p = 0;
6670 	

At conditional (2): "i < nfonts" taking true path
At conditional (4): "i < nfonts" taking false path

6671 	      for (i = 0; i < nfonts; ++i)

At conditional (3): "font_scalable_p != 0" taking false path

6672 		if (font_scalable_p (fonts + i))
6673 		  {
6674 		    if (best == NULL
6675 			|| better_font_p (specified, fonts + i, best, 0, 0)
6676 			|| (!non_scalable_has_exact_height_p
6677 			    && !better_font_p (specified, best, fonts + i, 0, 0)))
6678 		      {
6679 			non_scalable_has_exact_height_p = 1;
6680 			best = fonts + i;
6681 		      }
6682 		  }
6683 	

At conditional (5): "needs_overstrike != 0" taking true path

6684 	      if (needs_overstrike)
6685 		{
6686 		  enum xlfd_weight want_weight = specified[XLFD_WEIGHT];

Event var_deref_op: Variable "best" tracked as NULL was dereferenced.
Also see events: [var_compare_op]

6687 		  enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT];
6688 	
6689 		  if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight)

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

* Re: Problem report #17
  2006-04-10 18:50 Problem report #17 Dan Nicolaescu
@ 2006-05-11  5:10 ` Dan Nicolaescu
  2006-05-11  7:41   ` Problem report #17 FALSE Kenichi Handa
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Nicolaescu @ 2006-05-11  5:10 UTC (permalink / raw)



This has changed a bit in the latest report, maybe it rings a bell to
someone now... 

Checker: FORWARD_NULL (help)
File: base/src/emacs/src/xfaces.c
Function: best_matching_font
Description: Variable "best" tracked as NULL was passed to a function
that dereferences it.

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

6668 	      if (best && best->numeric[XLFD_POINT_SIZE] == pt)
6669 		non_scalable_has_exact_height_p = 1;
6670 	      else
6671 		non_scalable_has_exact_height_p = 0;
6672 	

At conditional (2): "i < nfonts" taking false path

6673 	      for (i = 0; i < nfonts; ++i)
6674 		if (font_scalable_p (fonts + i))
6675 		  {
6676 		    if (best == NULL
6677 			|| better_font_p (specified, fonts + i, best, 0, 0)
6678 			|| (!non_scalable_has_exact_height_p
6679 			    && !better_font_p (specified, best, fonts + i, 0, 0)))
6680 		      {
6681 			non_scalable_has_exact_height_p = 1;
6682 			best = fonts + i;
6683 		      }
6684 		  }
6685 	

At conditional (3): "needs_overstrike != 0" taking true path

6686 	      if (needs_overstrike)
6687 		{
6688 		  enum xlfd_weight want_weight = specified[XLFD_WEIGHT];

Event var_deref_op: Variable "best" tracked as NULL was dereferenced.
Also see events: [var_compare_op][var_deref_model]

6689 		  enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT];
6690 	
6691 		  if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight)
6692 		    {
6693 		      /* We want a bold font, but didn't get one; try to use
6694 			 overstriking instead to simulate bold-face.  However,
6695 			 don't overstrike an already-bold fontn unless the
6696 			 desired weight grossly exceeds the available weight.  */
6697 		      if (got_weight > XLFD_WEIGHT_MEDIUM)
6698 			*needs_overstrike = (got_weight - want_weight) > 2;
6699 		      else
6700 			*needs_overstrike = 1;
6701 		    }
6702 		}
6703 	    }
6704 	

Event var_deref_model: Variable "best" tracked as NULL was passed to a function that dereferences it. [model]
Also see events: [var_compare_op][var_deref_op]

6705 	  if (font_scalable_p (best))
6706 	    font_name = build_scalable_font_name (f, best, pt);
6707 	  else
6708 	    font_name = build_font_name (best);
6709 	
6710 	  /* Free font_name structures.  */
6711 	  free_font_names (fonts, nfonts);
6712 	
6713 	  return font_name;
6714 	}
6715 	
6716 	

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

* Re: Problem report #17 FALSE
  2006-05-11  5:10 ` Dan Nicolaescu
@ 2006-05-11  7:41   ` Kenichi Handa
  0 siblings, 0 replies; 5+ messages in thread
From: Kenichi Handa @ 2006-05-11  7:41 UTC (permalink / raw)
  Cc: emacs-devel

In article <200605110510.k4B5AAF1011901@amrm2.ics.uci.edu>, Dan Nicolaescu <dann@ics.uci.edu> writes:

> This has changed a bit in the latest report, maybe it rings a bell to
> someone now... 

> Checker: FORWARD_NULL (help)
> File: base/src/emacs/src/xfaces.c
> Function: best_matching_font
> Description: Variable "best" tracked as NULL was passed to a function
> that dereferences it.

I see no bug here.  It is assured thta nfonts > 0 when we
reach the following code.  If there's a non-scalable font,
best != NULL.  If there's no non-scalable font, there's a
scalable font.  So, best is set to non-NULL at line 6682.

---
Kenichi Handa
handa@m17n.org


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

> 6668 	      if (best && best->numeric[XLFD_POINT_SIZE] == pt)
> 6669 		non_scalable_has_exact_height_p = 1;
> 6670 	      else
> 6671 		non_scalable_has_exact_height_p = 0;
> 6672 	

> At conditional (2): "i < nfonts" taking false path

> 6673 	      for (i = 0; i < nfonts; ++i)
> 6674 		if (font_scalable_p (fonts + i))
> 6675 		  {
> 6676 		    if (best == NULL
> 6677 			|| better_font_p (specified, fonts + i, best, 0, 0)
> 6678 			|| (!non_scalable_has_exact_height_p
> 6679 			    && !better_font_p (specified, best, fonts + i, 0, 0)))
> 6680 		      {
> 6681 			non_scalable_has_exact_height_p = 1;
> 6682 			best = fonts + i;
> 6683 		      }
> 6684 		  }
> 6685 	

> At conditional (3): "needs_overstrike != 0" taking true path

> 6686 	      if (needs_overstrike)
> 6687 		{
> 6688 		  enum xlfd_weight want_weight = specified[XLFD_WEIGHT];

> Event var_deref_op: Variable "best" tracked as NULL was dereferenced.
> Also see events: [var_compare_op][var_deref_model]

> 6689 		  enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT];
> 6690 	
> 6691 		  if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight)
> 6692 		    {
> 6693 		      /* We want a bold font, but didn't get one; try to use
> 6694 			 overstriking instead to simulate bold-face.  However,
> 6695 			 don't overstrike an already-bold fontn unless the
> 6696 			 desired weight grossly exceeds the available weight.  */
> 6697 		      if (got_weight > XLFD_WEIGHT_MEDIUM)
> 6698 			*needs_overstrike = (got_weight - want_weight) > 2;
> 6699 		      else
> 6700 			*needs_overstrike = 1;
> 6701 		    }
> 6702 		}
> 6703 	    }
> 6704 	

> Event var_deref_model: Variable "best" tracked as NULL was passed to a function that dereferences it. [model]
> Also see events: [var_compare_op][var_deref_op]

> 6705 	  if (font_scalable_p (best))
> 6706 	    font_name = build_scalable_font_name (f, best, pt);
> 6707 	  else
> 6708 	    font_name = build_font_name (best);
> 6709 	
> 6710 	  /* Free font_name structures.  */
> 6711 	  free_font_names (fonts, nfonts);
> 6712 	
> 6713 	  return font_name;
> 6714 	}
> 6715 	
> 6716 	


> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel

o

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

* Problem report #17
@ 2006-05-20 18:01 Dan Nicolaescu
  2006-05-22  2:39 ` Richard Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Nicolaescu @ 2006-05-20 18:01 UTC (permalink / raw)



This one appeared on May 15th, and it seems to be related to the
crashes reported on the pretest list. 

Can somebody please take a look?

CID: 17
Checker: FORWARD_NULL (help)
File: base/src/emacs/src/xfaces.c
Function: best_matching_font
Description: Variable "best" tracked as NULL was dereferenced.


6591 	static char *
6592 	best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike)
6593 	     struct frame *f;
6594 	     Lisp_Object *attrs;
6595 	     struct font_name *fonts;
6596 	     int nfonts;
6597 	     int width_ratio;
6598 	     int *needs_overstrike;
6599 	{
6600 	  char *font_name;
6601 	  struct font_name *best;
6602 	  int i, pt = 0;
6603 	  int specified[5];
6604 	  int exact_p, avgwidth;
6605 	
6606 	  if (nfonts == 0)
6607 	    return NULL;
6608 	
6609 	  /* Make specified font attributes available in `specified',
6610 	     indexed by sort order.  */
6611 	  for (i = 0; i < DIM (font_sort_order); ++i)
6612 	    {
6613 	      int xlfd_idx = font_sort_order[i];
6614 	
6615 	      if (xlfd_idx == XLFD_SWIDTH)
6616 		specified[i] = face_numeric_swidth (attrs[LFACE_SWIDTH_INDEX]);
6617 	      else if (xlfd_idx == XLFD_POINT_SIZE)
6618 		specified[i] = pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]);
6619 	      else if (xlfd_idx == XLFD_WEIGHT)
6620 		specified[i] = face_numeric_weight (attrs[LFACE_WEIGHT_INDEX]);
6621 	      else if (xlfd_idx == XLFD_SLANT)
6622 		specified[i] = face_numeric_slant (attrs[LFACE_SLANT_INDEX]);
6623 	      else
6624 		abort ();
6625 	    }
6626 	
6627 	  avgwidth = (UNSPECIFIEDP (attrs[LFACE_AVGWIDTH_INDEX])
6628 		      ? 0
6629 		      : XFASTINT (attrs[LFACE_AVGWIDTH_INDEX]) * width_ratio);
6630 	
6631 	  exact_p = 0;
6632 	
6633 	  if (needs_overstrike)
6634 	    *needs_overstrike = 0;
6635 	
6636 	  best = NULL;
6637 	
6638 	  /* Find the best match among the non-scalable fonts.  */
6639 	  for (i = 1; i < nfonts; ++i)
6640 	    if (!font_scalable_p (fonts + i)
6641 		&& better_font_p (specified, fonts + i, best, 1, avgwidth))
6642 	      {
6643 		best = fonts + i;
6644 	
6645 		exact_p = exact_face_match_p (specified, best, avgwidth);
6646 		if (exact_p)
6647 		  break;
6648 	      }
6649 	
6650 	  /* Unless we found an exact match among non-scalable fonts, see if
6651 	     we can find a better match among scalable fonts.  */
6652 	  if (!exact_p)
6653 	    {
6654 	      /* A scalable font is better if
6655 	
6656 		 1. its weight, slant, swidth attributes are better, or.
6657 	
6658 		 2. the best non-scalable font doesn't have the required
6659 		 point size, and the scalable fonts weight, slant, swidth
6660 		 isn't worse.  */
6661 	
6662 	      int non_scalable_has_exact_height_p;
6663 	

Event var_compare_op: Added "best" due to comparison "best != 0"
Also see events: [var_deref_op]
At conditional (1): "best != 0" taking false path

6664 	      if (best && best->numeric[XLFD_POINT_SIZE] == pt)
6665 		non_scalable_has_exact_height_p = 1;
6666 	      else
6667 		non_scalable_has_exact_height_p = 0;
6668 	

At conditional (2): "i < nfonts" taking true path
At conditional (4): "i < nfonts" taking false path

6669 	      for (i = 0; i < nfonts; ++i)

At conditional (3): "font_scalable_p != 0" taking false path

6670 		if (font_scalable_p (fonts + i))
6671 		  {
6672 		    if (better_font_p (specified, fonts + i, best, 0, 0)
6673 			|| (!non_scalable_has_exact_height_p
6674 			    && !better_font_p (specified, best, fonts + i, 0, 0)))
6675 		      {
6676 			non_scalable_has_exact_height_p = 1;
6677 			best = fonts + i;
6678 		      }
6679 		  }
6680 	

At conditional (5): "needs_overstrike != 0" taking true path

6681 	      if (needs_overstrike)
6682 		{
6683 		  enum xlfd_weight want_weight = specified[XLFD_WEIGHT];

Event var_deref_op: Variable "best" tracked as NULL was dereferenced.
Also see events: [var_compare_op]

6684 		  enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT];
6685 	
6686 		  if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight)
6687 		    {
6688 		      /* We want a bold font, but didn't get one; try to use
6689 			 overstriking instead to simulate bold-face.  However,
6690 			 don't overstrike an already-bold fontn unless the
6691 			 desired weight grossly exceeds the available weight.  */
6692 		      if (got_weight > XLFD_WEIGHT_MEDIUM)
6693 			*needs_overstrike = (got_weight - want_weight) > 2;
6694 		      else
6695 			*needs_overstrike = 1;
6696 		    }
6697 		}
6698 	    }
6699 	
6700 	  /* We should have found SOME font.  */
6701 	  if (best == NULL)
6702 	    abort ();
6703 	
6704 	  if (font_scalable_p (best))
6705 	    font_name = build_scalable_font_name (f, best, pt);
6706 	  else
6707 	    font_name = build_font_name (best);
6708 	
6709 	  /* Free font_name structures.  */
6710 	  free_font_names (fonts, nfonts);
6711 	
6712 	  return font_name;
6713 	}
6714 	

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

* Re: Problem report #17
  2006-05-20 18:01 Problem report #17 Dan Nicolaescu
@ 2006-05-22  2:39 ` Richard Stallman
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2006-05-22  2:39 UTC (permalink / raw)
  Cc: emacs-devel

I got rid of that one in a way I think is harmless.

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

end of thread, other threads:[~2006-05-22  2:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-10 18:50 Problem report #17 Dan Nicolaescu
2006-05-11  5:10 ` Dan Nicolaescu
2006-05-11  7:41   ` Problem report #17 FALSE Kenichi Handa
  -- strict thread matches above, loose matches on Subject: below --
2006-05-20 18:01 Problem report #17 Dan Nicolaescu
2006-05-22  2:39 ` Richard Stallman

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