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

[Crash]: in Blitter_32bppAnim::Draw<(BlitterMode)0> #9659

Closed
jirislaby opened this issue Oct 27, 2021 · 2 comments
Closed

[Crash]: in Blitter_32bppAnim::Draw<(BlitterMode)0> #9659

jirislaby opened this issue Oct 27, 2021 · 2 comments

Comments

@jirislaby
Copy link

Version of OpenTTD

12

Steps to reproduce

Run openttd and wait for the crash.

Upload crash files

crash.zip

(gdb) where
...
#4  0x000055e8fe1d1d14 in HandleCrash (signum=11) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/os/unix/crashlog_unix.cpp:175
#5  <signal handler called>
#6  0x000055e8fe13b7a3 in Blitter_32bppAnim::Draw<(BlitterMode)0> (zoom=<optimized out>, bp=0x7ffc4cda0790, this=0x55e901c43410) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/blitter/32bpp_anim.cpp:234
#7  Blitter_32bppAnim::Draw (this=0x55e901c43410, bp=0x7ffc4cda0790, mode=<optimized out>, zoom=<optimized out>) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/blitter/32bpp_anim.cpp:264
#8  0x000055e8fe490f24 in GfxBlitter<4, false>(Sprite const*, int, int, BlitterMode, SubSprite const*, unsigned int, ZoomLevel, DrawPixelInfo const*) [clone .constprop.0] (sprite=<optimized out>, x=<optimized out>,
    y=<optimized out>, mode=BM_NORMAL, sub=<optimized out>, sprite_id=<optimized out>, zoom=ZOOM_LVL_OUT_2X, dst=0x0) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/gfx.cpp:1186
#9  0x000055e8fe2d5473 in GfxMainBlitterViewport (sprite_id=1012, sub=0x0, mode=BM_NORMAL, y=12800, x=-20992, sprite=<optimized out>) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/gfx.cpp:1232
#10 DrawSpriteViewport (img=<optimized out>, pal=0, x=-20992, y=12800, sub=0x0) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/gfx.cpp:1028
#11 0x000055e8fe4704b1 in ViewportDrawTileSprites (tstdv=<optimized out>) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/viewport.cpp:1496
#12 ViewportDoDraw (vp=0x7f09dc33b9b0, left=<optimized out>, top=<optimized out>, right=<optimized out>, bottom=<optimized out>) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/viewport.cpp:1747
#13 0x000055e8fe470e97 in ViewportDraw (bottom=<optimized out>, right=<optimized out>, top=<optimized out>, left=<optimized out>, vp=<optimized out>) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/viewport.cpp:1803
#14 Window::DrawViewport (this=0x7f09dc301110) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/viewport.cpp:1823
#15 0x000055e8fe481995 in NWidgetViewport::Draw (this=0x7f09dc3011e0, w=<optimized out>) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/widget.cpp:2051
#16 0x000055e8fe47c704 in NWidgetPIPContainer::Draw (this=<optimized out>, w=0x7f09dc301110) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/widget.cpp:1236
#17 0x000055e8fe47a5f1 in Window::DrawWidgets (this=0x7f09dc301110) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/widget.cpp:638
#18 0x000055e8fe3206e0 in MainWindow::OnPaint (this=0x7f09dc301110) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/main_gui.cpp:247
#19 0x000055e8fe47f80e in DrawOverlappedWindowForAll (left=0, top=<optimized out>, right=791, bottom=1056) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/window.cpp:983
#20 0x000055e8fe2d619f in RedrawScreenRect (left=0, top=0, right=791, bottom=1056) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/gfx.cpp:1587
#21 0x000055e8fe46e728 in DoSetViewportPosition (it=..., left=<optimized out>, top=<optimized out>, width=<optimized out>, height=<optimized out>) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/viewport.cpp:279
#22 0x000055e8fe46e874 in SetViewportPosition (w=<optimized out>, x=<optimized out>, y=<optimized out>) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/viewport.cpp:387
#23 0x000055e8fe46eaf9 in UpdateViewportPosition (w=0x7f09dc301110) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/viewport.cpp:1898
#24 0x000055e8fe30ce49 in SelectGameWindow::OnRealtimeTick (this=0x7f09dc301320, delta_ms=<optimized out>) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/intro_gui.cpp:234
#25 0x000055e8fe485249 in CallWindowRealtimeTickEvent (delta_ms=delta_ms@entry=16) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/window.cpp:3051
#26 0x000055e8fe48802a in UpdateWindows () at /usr/src/debug/openttd-12.0-1.1.x86_64/src/window.cpp:3070
#27 0x000055e8fe252690 in VideoDriver::Tick (this=0x55e9016f63f0) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/video/video_driver.cpp:149
#28 0x000055e8fe252818 in VideoDriver_SDL::MainLoop (this=0x55e9016f63f0) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/video/sdl_v.cpp:652
#29 0x000055e8fe3855f1 in openttd_main (argc=<optimized out>, argv=0x7ffc4cda0e80) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/openttd.cpp:802
#30 0x00007f0a18d12540 in __libc_start_call_main (main=main@entry=0x55e8fdfe4be0 <main(int, char**)>, argc=argc@entry=1, argv=argv@entry=0x7ffc4cda3198) at ../sysdeps/nptl/libc_start_call_main.h:58
#31 0x00007f0a18d125ec in __libc_start_main_impl (main=0x55e8fdfe4be0 <main(int, char**)>, argc=1, argv=0x7ffc4cda3198, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
    stack_end=0x7ffc4cda3188) at ../csu/libc-start.c:409
#32 0x000055e8fe080105 in _start () at ../sysdeps/x86_64/start.S:116
(gdb) frame 6
#6  0x000055e8fe13b7a3 in Blitter_32bppAnim::Draw<(BlitterMode)0> (zoom=<optimized out>, bp=0x7ffc4cda0790, this=0x55e901c43410) at /usr/src/debug/openttd-12.0-1.1.x86_64/src/blitter/32bpp_anim.cpp:234
234                                                                     *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(m), GB(*src_n, 8, 8)), src_px->a, *dst);
(gdb) l
229                                             } else {
230                                                     do {
231                                                             uint m = GB(*src_n, 0, 8);
232                                                             *anim++ = 0;
233                                                             if (m >= PALETTE_ANIM_START) {
234                                                                     *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(m), GB(*src_n, 8, 8)), src_px->a, *dst);
235                                                             } else {
236                                                                     *dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
237                                                             }
238                                                             dst++;
(gdb) disass 0x000055e8fe13b7a3
Dump of assembler code for function _ZN17Blitter_32bppAnim4DrawEPN7Blitter13BlitterParamsE11BlitterMode9ZoomLevel:
...
   0x000055e8fe13b789 <+2345>:  shr    $0x8,%esi
   0x000055e8fe13b78c <+2348>:  add    %esi,%edx
   0x000055e8fe13b78e <+2350>:  movzbl 0x2(%r12),%esi
   0x000055e8fe13b794 <+2356>:  sub    %r8d,%esi
   0x000055e8fe13b797 <+2359>:  imul   %edi,%esi
   0x000055e8fe13b79a <+2362>:  shr    $0x8,%esi
   0x000055e8fe13b79d <+2365>:  add    %esi,%ecx
   0x000055e8fe13b79f <+2367>:  add    $0x2,%rbp
=> 0x000055e8fe13b7a3 <+2371>:  mov    %al,(%rbx)
   0x000055e8fe13b7a5 <+2373>:  add    $0x4,%r12
   0x000055e8fe13b7a9 <+2377>:  add    $0x4,%rbx
   0x000055e8fe13b7ad <+2381>:  mov    %dl,-0x3(%rbx)
(gdb) p/x $rbx
$2 = 0x7f0a16347000
(gdb) p dst
$3 = (Colour *) 0x7f0a16347000

It looks like dst went out of bounds.

@glx22
Copy link
Contributor

glx22 commented Oct 27, 2021

Most likely a duplicate #9622.
Try setting zoom_min to 0 or 1 in [gui] section of openttd.cfg.

@jirislaby
Copy link
Author

Most likely a duplicate #9622. Try setting zoom_min to 0 or 1 in [gui] section of openttd.cfg.

Yep, this makes it work. The zoom of the background image now switches at the point it previously crashed.

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

No branches or pull requests

2 participants