Menu

#278 Xfw crashes selecting a font

v1.0_(example)
closed-fixed
xfw (3)
5
2024-01-03
2023-11-14
Ian
No

Clicking on "Font..." in preferences results in a crash. I've reported this against Fedora here (with log files attached):

https://bugzilla.redhat.com/show_bug.cgi?id=2249586

GUI is Xfce on Fedora 39.

Discussion

  • Mamoru TASAKA

    Mamoru TASAKA - 2023-11-14

    Apparently specifying more size than the size of destination buffer is not right.
    Suggested patch:

    --- xfe-1.45/src/FontDialog.cpp.debug   2022-12-23 20:05:51.000000000 +0900
    +++ xfe-1.45/src/FontDialog.cpp 2023-11-14 22:47:01.250243819 +0900
    @@ -152,7 +152,7 @@
         preview->setBackColor(getApp()->getBackColor());
    
         FXString fontname = FXString(DEFAULT_NORMAL_FONT);
    -    strlcpy(selected.face, fontname.before(',').text(), sizeof(selected.face) + 1);
    +    strlcpy(selected.face, fontname.before(',').text(), sizeof(selected.face));
         selected.size = 90;
         selected.weight = FXFont::Bold;
         selected.slant = 0;
    @@ -203,7 +203,7 @@
                 familylist->setCurrentItem(selindex);
                 familylist->makeItemVisible(selindex);
                 family->setText(familylist->getItemText(selindex));
    -            strlcpy(selected.face, familylist->getItemText(selindex).text(), sizeof(selected.face) + 1);
    +            strlcpy(selected.face, familylist->getItemText(selindex).text(), sizeof(selected.face));
             }
             FXFREE(&fonts);
         }
    @@ -464,7 +464,7 @@
     // Selected font family
     long FontSelector::onCmdFamily(FXObject*, FXSelector, void* ptr)
     {
    -    strlcpy(selected.face, familylist->getItemText((int)(FXival)ptr).text(), sizeof(selected.face) + 1);
    +    strlcpy(selected.face, familylist->getItemText((int)(FXival)ptr).text(), sizeof(selected.face));
         family->setText(selected.face);
         listWeights();
         listSlants();
    
     
  • Roland Baudin

    Roland Baudin - 2023-11-16

    Thanks for the report and the patch. I think the problem is related to the glibc version you have. Do you have glibc version 2.38 or above?

     
  • Mamoru TASAKA

    Mamoru TASAKA - 2023-11-16

    Fedora 39 glibc is 2.38 .

     
    • Roland Baudin

      Roland Baudin - 2023-11-16

      OK, I see.

      The problem arises because Xfe uses its own implementation of the strlcpy() function and this function is now part of the glibc since 2.38. The strlcpy() used in Xfe needs a +1 in the size of the destination string, while the strlcpy() from glibc does not.

      I'll fix the issue and release a new version in the next days.

       
  • Roland Baudin

    Roland Baudin - 2024-01-03

    This bug has been fixed in Xfe 1.46.

     
  • Roland Baudin

    Roland Baudin - 2024-01-03
    • status: open --> closed-fixed
     

Log in to post a comment.