Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Div by 0 in stbtt since last update #5139

Closed
mgerhardy opened this issue Mar 26, 2022 · 4 comments
Closed

Div by 0 in stbtt since last update #5139

mgerhardy opened this issue Mar 26, 2022 · 4 comments

Comments

@mgerhardy
Copy link

Bildschirmfoto von 2022-03-26 21-01-37

Thread 1 "vengi-voxedit" received signal SIGFPE, Arithmetic exception.
stbtt__fill_active_edges_new (scanline=0x7fffffffb090, scanline_fill=0x7fffffffb114, len=32, e=0x62b00097c588, y_top=-1) at /home/mgerhardy/dev/engine/src/modules/ui/imgui/dearimgui/imstb_truetype.h:3204
3204	                  dy = (y_final - y_crossing ) / (x2 - (x1+1)); // if denom=0, y_final = y_crossing, so y_final <= y_bottom
(gdb) bt
#0  stbtt__fill_active_edges_new (scanline=0x7fffffffb090, scanline_fill=0x7fffffffb114, len=32, e=0x62b00097c588, y_top=-1) at /home/mgerhardy/dev/engine/src/modules/ui/imgui/dearimgui/imstb_truetype.h:3204
#1  0x0000555555de07c6 in stbtt__rasterize_sorted_edges (result=0x7fffffffb5d0, e=0x61600003d3c0, n=18, vsubsample=1, off_x=0, off_y=-12, userdata=0x0) at /home/mgerhardy/dev/engine/src/modules/ui/imgui/dearimgui/imstb_truetype.h:3366
#2  0x0000555555de2973 in stbtt__rasterize (result=0x7fffffffb5d0, pts=0x611000024940, wcount=0x602000060030, windings=1, scale_x=0.08203125, scale_y=0.02734375, shift_x=0, shift_y=0, off_x=0, off_y=-12, invert=1, userdata=0x0)
    at /home/mgerhardy/dev/engine/src/modules/ui/imgui/dearimgui/imstb_truetype.h:3547
#3  0x0000555555de43eb in stbtt_Rasterize (result=0x7fffffffb5d0, flatness_in_pixels=0.349999994, vertices=0x61600003cf80, num_verts=27, scale_x=0.08203125, scale_y=0.02734375, shift_x=0, shift_y=0, x_off=0, y_off=-12, invert=1, userdata=0x0)
    at /home/mgerhardy/dev/engine/src/modules/ui/imgui/dearimgui/imstb_truetype.h:3707
#4  0x0000555555de517a in stbtt_MakeGlyphBitmapSubpixel (info=0x61d00003ad90, output=0x7fffe0802c01 "", out_w=32, out_h=13, out_stride=1024, scale_x=0.08203125, scale_y=0.02734375, shift_x=0, shift_y=0, glyph=184)
    at /home/mgerhardy/dev/engine/src/modules/ui/imgui/dearimgui/imstb_truetype.h:3777
#5  0x0000555555de9f51 in stbtt_PackFontRangesRenderIntoRects (spc=0x7fffffffbaf0, info=0x61d00003ad90, ranges=0x61d00003ae30, num_ranges=1, rects=0x62f00001d648) at /home/mgerhardy/dev/engine/src/modules/ui/imgui/dearimgui/imstb_truetype.h:4251
#6  0x0000555555e1b4e3 in ImFontAtlasBuildWithStbTruetype (atlas=0x61a000040e80) at /home/mgerhardy/dev/engine/src/modules/ui/imgui/dearimgui/imgui_draw.cpp:2543
#7  0x0000555555e18017 in ImFontAtlas::Build (this=0x61a000040e80) at /home/mgerhardy/dev/engine/src/modules/ui/imgui/dearimgui/imgui_draw.cpp:2294
#8  0x0000555555e13ad8 in ImFontAtlas::GetTexDataAsAlpha8 (this=0x61a000040e80, out_pixels=0x7fffffffbdd0, out_width=0x0, out_height=0x0, out_bytes_per_pixel=0x0) at /home/mgerhardy/dev/engine/src/modules/ui/imgui/dearimgui/imgui_draw.cpp:2050
#9  0x0000555555e13db7 in ImFontAtlas::GetTexDataAsRGBA32 (this=0x61a000040e80, out_pixels=0x7fffffffbec0, out_width=0x7fffffffbea0, out_height=0x7fffffffbeb0, out_bytes_per_pixel=0x0) at /home/mgerhardy/dev/engine/src/modules/ui/imgui/dearimgui/imgui_draw.cpp:2065
#10 0x0000555555c3ce48 in ui::imgui::IMGUIApp::loadFonts (this=0x7fffffffc890) at /home/mgerhardy/dev/engine/src/modules/ui/imgui/IMGUIApp.cpp:202
#11 0x0000555555c3e95f in ui::imgui::IMGUIApp::onInit (this=0x7fffffffc890) at /home/mgerhardy/dev/engine/src/modules/ui/imgui/IMGUIApp.cpp:298
#12 0x00005555557c9ddb in VoxEdit::onInit (this=0x7fffffffc890) at /home/mgerhardy/dev/engine/src/tools/voxedit/VoxEdit.cpp:197
#13 0x0000555556031fa3 in app::App::onFrame (this=0x7fffffffc890) at /home/mgerhardy/dev/engine/src/modules/app/App.cpp:164
#14 0x00005555560310e4 in app::App::startMainLoop (this=0x7fffffffc890, argc=1, argv=0x7fffffffe018) at /home/mgerhardy/dev/engine/src/modules/app/App.cpp:89
#15 0x00005555557ca898 in main (argc=1, argv=0x7fffffffe018) at /home/mgerhardy/dev/engine/src/tools/voxedit/VoxEdit.cpp:273
(gdb) p x2
$1 = 21
(gdb) p x1
$2 = 20
(gdb) 

mgerhardy added a commit to vengi-voxel/vengi that referenced this issue Mar 26, 2022
@PathogenDavid
Copy link
Contributor

What font(s) are you using? Are you specifying any glyph ranges?

@ocornut
Copy link
Owner

ocornut commented Mar 28, 2022

Thank you!
Yes we would need a repro (font file, settings) and an issue should be opened at https://github.com/nothings/stb/

@ocornut
Copy link
Owner

ocornut commented Mar 29, 2022

Based on Sean's answer I have pushed your fix into Dear ImGui's copy.
Commit 88fbc31
Would be good to still have a font/repro to double-check things, @mgerhardy ?

@ocornut ocornut closed this as completed Mar 29, 2022
@ocornut
Copy link
Owner

ocornut commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants