[libcroco-list] small bugs in libcroco



Hi,

In libcroco-0.6.1, the following codes appear to be bugs:

1) In cr-fonts.c:288, the return value of cr_font_family_prepend()
should be "the font family list", not CR_OK which is the same as NULL.

***************
*** 285,291 ****
          a_family_to_prepend->next = a_this;
          a_this->prev = a_family_to_prepend;
  
!         return CR_OK;
  }
  
  /**
--- 286,292 ----
          a_family_to_prepend->next = a_this;
          a_this->prev = a_family_to_prepend;
  
!         return a_family_to_prepend;
  }
  
  /**


2) In cr-fonts.c:669, the logic of cr_font_weight_get_bolder
does not take into account the FONT_WEIGHT_INHERIT value, and the
shift by 1 can yield out-of-range values. Partial fix:

***************
*** 766,772 ****
  enum CRFontWeight
  cr_font_weight_get_bolder (enum CRFontWeight a_weight)
  {
!         if (a_weight >= NB_FONT_WEIGHTS) {
                  return FONT_WEIGHT_900 ;
          } else if (a_weight < FONT_WEIGHT_NORMAL) {
                  return FONT_WEIGHT_NORMAL ;
--- 767,773 ----
  enum CRFontWeight
  cr_font_weight_get_bolder (enum CRFontWeight a_weight)
  {
!         if (a_weight >= FONT_WEIGHT_900) {
                  return FONT_WEIGHT_900 ;
          } else if (a_weight < FONT_WEIGHT_NORMAL) {
                  return FONT_WEIGHT_NORMAL ;


3) In cr-sel-eng.c, there are several uses of strncmp that look fishy.
For example, in id_add_sel_matches_node (cr-sel-eng.c:275), if the XML node
has the "id" "foobar", and the selector is "#foo", i.e.
a_add_sel->content.id_name->stryng->str = "foo", the rule will match!


Bruno



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]