Source: imgui Version: 1.79+ds-1 Severity: serious Hi,
I tried to build an application that uses imgui, but it crashes with a "Floating point exception". Then I tried to build the examples included in the libimgui-dev package and noticed that they crash as well in the same function. Steps to reproduce: $ mkdir /tmp/imgui $ cp /usr/share/doc/libimgui-dev/examples/{example_null/main.cpp,imgui_impl_opengl3.*} /tmp/imgui/ $ cd /tmp/imgui $ g++ main.cpp imgui_impl_opengl3.cpp $(pkg-config imgui glew stb --cflags --libs) $ ./a.out Floating point exception $ gdb ./a.out (gdb) run Starting program: /tmp/imgui/a.out Program received signal SIGFPE, Arithmetic exception. 0x00007ffff7e2773f in stbrp__skyline_find_best_pos (height=64, width=64, c=0x55555560fbb0) at stb_rect_pack.c:350 350 stb_rect_pack.c: No such file or directory. (gdb) bt #0 0x00007ffff7e2773f in stbrp__skyline_find_best_pos (height=64, width=64, c=0x55555560fbb0) at stb_rect_pack.c:350 #1 stbrp__skyline_pack_rectangle (height=64, width=65, context=0x55555560fbb0) at stb_rect_pack.c:447 #2 stbrp_pack_rects (context=0x55555560fbb0, rects=0x55555560fde0, num_rects=2) at stb_rect_pack.c:563 #3 0x0000555555596563 in ImFontAtlasBuildPackCustomRects(ImFontAtlas*, void*) () #4 0x00005555555999e8 in ImFontAtlasBuildWithStbTruetype(ImFontAtlas*) () #5 0x000055555559a53f in ImFontAtlas::GetTexDataAsAlpha8(unsigned char**, int*, int*, int*) () #6 0x000055555559a5f5 in ImFontAtlas::GetTexDataAsRGBA32(unsigned char**, int*, int*, int*) () #7 0x0000555555557e15 in main () (gdb) p *c $1 = { width = 511, height = 32767, align = 0, init_mode = 0, heuristic = 0, num_nodes = 21845, active_head = 0x211, free_head = 0x7ffff7ab1be0 <main_arena+96>, extra = {{ x = 7136, y = 63403, next = 0x0 }, { x = 0, y = 0, next = 0x41077b4210bb410f }} } stb_rect_pack.h from libstb-dev (0.0~git20200713.b42009b-1) contains the function stbrp__skyline_find_best_pos: static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height) { ... width -= width % c->align; As seen above in gdb, c->align is 0, so this line will cause a division by zero, which triggers the exception. I'm not sure if the problem is really in imgui which does not initialize the stb context properly, or if it's a problem in libstb. Kind regards, Reiner
signature.asc
Description: PGP signature