pioneerspacesim/pioneer — Issue #727: Screenshot crash in full-screen (Linux)
Author: robn
Created: 2011-10-26 03:57:55+00:00
State: open
Labels: Crash or hang

Reported by firemark in IRC. Possibly related to #645.

When taking screenshots in full-screen, the game crashes. Sample trace:

```
#0 0x00007f4485d08455 in raise () from /lib64/libc.so.6
#1 0x00007f4485d09870 in abort () from /lib64/libc.so.6
#2 0x00007f4485d4399b in __libc_message () from /lib64/libc.so.6
#3 0x00007f4485d48f66 in malloc_printerr () from /lib64/libc.so.6
#4 0x00007f4485d4dcfc in free () from /lib64/libc.so.6
#5 0x0000000000554baa in deallocate (destFile=, W=1366, H=768) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/include/g++-v4/ext/new_allocator.h:98
#6 _M_deallocate (destFile=, W=1366, H=768) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/include/g++-v4/bits/stl_vector.h:156
#7 ~_Vector_base (destFile=, W=1366, H=768) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/include/g++-v4/bits/stl_vector.h:142
#8 ~vector (destFile=, W=1366, H=768) at /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/include/g++-v4/bits/stl_vector.h:351
#9 Screendump (destFile=, W=1366, H=768) at utils.cpp:447
#10 0x00000000004c4de6 in Pi::HandleEvents () at Pi.cpp:704
#11 0x00000000004c57b0 in Pi::MainLoop () at Pi.cpp:1353
#12 0x00000000004c712a in Pi::Start () at Pi.cpp:1261
#13 0x0000000000552375 in main (argc=) at main.cpp:18
```

For reference, utils.cpp:447 looks like this:

```
std::vector pixel_data(3*W*H);
```

This smells very much of a stack smash.

On one occassion it did work, producing the following screenshot:

![](http://i.imgur.com/IRDiK.jpg)

Based on this, I'm guessing that there's a pixel format involved somewhere that is wider than expected, overrunning the buffer. I've not looked into it any further than this.