View Issue Details

IDProjectCategoryView StatusLast Update
0002946NoesisGUIC++ SDKpublic2024-01-22 16:29
ReporterS.Harelysh Assigned Tojsantos  
PriorityhighSeveritymajor 
Status resolvedResolutionfixed 
Product Version3.2.2 
Target Version3.2.3Fixed in Version3.2.3 
Summary0002946: NoesisGUI allocates 4GB for system fonts
Description

NoesisGUI traverses the system (Ubuntu22.04) font directory ("/usr/share/fonts") and attempts to register fonts using subdirectory paths as font file paths. It turned out that the file Stream could not get the correct length for directories and returned (uint32_t)-1 (https://man7.org/linux/man-pages/man3/ftell.3p.html). So HB::BlobCreate() tries to allocate (uint32_t)-1 (4GB) memory.

Please consider revising the system font directory traversal to avoid using subdirectory paths as font file paths. Probably dirent::d_type can be checked (https://man7.org/linux/man-pages/man3/readdir.3.html).

frame and backtrace:
(lldb) frame variable
(Noesis::Stream ) stream = 0x000002003a4ccac0
(noesis_hb_blob_t
) blob = 0x00000000ffffffff
(const char *) base = 0x0000000000000000
(uint32_t) length = 4294967295
(lldb) bt

  • thread #29, name = 'Main Thread', stop reason = step over
    • frame #0: libNoesis.soNoesis::HB::BlobCreate(stream=0x000002003a4ccac0) at HarfBuzz.cpp:156:5 frame #1: libNoesis.soNoesis::EnumFontFaces(stream=<unavailable>, callback=0x00007fff9a7f6720)> const&) at VGLFontFace.cpp:29:32
      frame #2: libNoesis.soNoesis::CachedFontProvider::RegisterFont(this=0x000002003a1f5000, folder=<unavailable>, filename=<unavailable>) at CachedFontProvider.cpp:41:22 frame #3: libNoesis.soNoesis::SystemFontProvider::ScanSystemFonts(this=0x000002003a1f5000, root="") at SystemFontProvider.cpp:321:33
Steps To Reproduce

1) It should be sub-folder inside inside the system fonts directory ("/usr/share/fonts"). Like "/usr/share/fonts/X11".
2) Call Noesis::GUI::SetFontFallbacks().

PlatformLinux

Activities

jsantos

jsantos

2023-12-15 10:36

manager   ~0009030

Interesting, thanks for the detailed report.

Issue History

Date Modified Username Field Change
2023-12-14 13:52 S.Harelysh New Issue
2023-12-14 13:52 S.Harelysh Tag Attached: Fonts
2023-12-14 13:57 S.Harelysh Priority normal => high
2023-12-15 08:15 S.Harelysh Summary Noesis allocates 4GB for system fonts => NoesisGUI allocates 4GB for system fonts
2023-12-15 08:15 S.Harelysh Description Updated
2023-12-15 10:35 jsantos Assigned To => jsantos
2023-12-15 10:35 jsantos Status new => assigned
2023-12-15 10:36 jsantos Target Version => 3.2.3
2023-12-15 10:36 jsantos Note Added: 0009030
2023-12-15 10:51 S.Harelysh Steps to Reproduce Updated
2024-01-22 11:47 sfernandez Target Version 3.2.3 => 3.2.4
2024-01-22 11:58 jsantos Target Version 3.2.4 => 3.2.3
2024-01-22 16:29 jsantos Status assigned => resolved
2024-01-22 16:29 jsantos Resolution open => fixed
2024-01-22 16:29 jsantos Fixed in Version => 3.2.3