Public bug reported:

There seems to be some problem with using the packaged version ImGui together 
with GLFW. As an example, cloning the original repository
(https://github.com/ocornut/imgui) and compiling the GLFW + OpenGl3 demo using 
the system packages with the command below:

```
g++ -ggdb -I/usr/include/imgui/backends $(pkg-config imgui --cflags) main.cpp 
-o test $(pkg-config imgui --libs --static) $(pkg-config glfw3 --libs --static) 
$(pkg-config glew --libs --static)
./test
```

Yields a crash with the messages:

```
malloc(): unsorted double linked list corrupted
Aborted (core dumped)
```

Which presumably means that the application (or imgui) is accidentally
overwriting some important `malloc` datastructures. Running it through
valgrind yields a bit more, the full log of which has been attached to
this ticket. Of particular interest are the lines:

```
==88620== Conditional jump or move depends on uninitialised value(s)
==88620==    at 0x489E32F: ??? (in /usr/lib/x86_64-linux-gnu/libstb.so.0.0)
==88620==    by 0x4D5561B: msort_with_tmp.part.0 (msort.c:104)
==88620==    by 0x4D55A55: msort_with_tmp (msort.c:44)
==88620==    by 0x4D55A55: qsort_r (msort.c:296)
==88620==    by 0x48A66F0: stbrp_pack_rects (in 
/usr/lib/x86_64-linux-gnu/libstb.so.0.0)
==88620==    by 0x15D342: ImFontAtlasBuildPackCustomRects(ImFontAtlas*, void*) 
(in /home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x160E27: ImFontAtlasBuildWithStbTruetype(ImFontAtlas*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x15EC9C: ImFontAtlas::GetTexDataAsAlpha8(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x15ED46: ImFontAtlas::GetTexDataAsRGBA32(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x10FBCB: ImGui_ImplOpenGL3_CreateFontsTexture() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x10FF9A: ImGui_ImplOpenGL3_CreateDeviceObjects() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x10D974: main (main.cpp:110)
==88620==  Uninitialised value was created by a heap allocation
==88620==    at 0x4847899: malloc (in 
/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==88620==    by 0x15D2D1: ImFontAtlasBuildPackCustomRects(ImFontAtlas*, void*) 
(in /home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x160E27: ImFontAtlasBuildWithStbTruetype(ImFontAtlas*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x15EC9C: ImFontAtlas::GetTexDataAsAlpha8(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x15ED46: ImFontAtlas::GetTexDataAsRGBA32(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x10FBCB: ImGui_ImplOpenGL3_CreateFontsTexture() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x10FF9A: ImGui_ImplOpenGL3_CreateDeviceObjects() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
==88620==    by 0x10D974: main (main.cpp:110)
```

Which implies something in the texture atlas-building goes wrong, but
I'm not familiar enough with the details here to offer a good opinion.

It's plausible that this is the same bug as reported in
https://bugs.launchpad.net/ubuntu/+source/imgui/+bug/1963556 , but I
have not been able to confirm that.

Admittedly, this is when running on the upcoming Xubuntu 22.04, so it
may be a beta-release bug, /however/, compiling and running the cloned
version of imgui directly works just fine.

** Affects: imgui (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

- There seems to be some problem with using the packaged version ImGui together
- with GLFW. As an example, cloning the original repository
- (https://github.com/ocornut/imgui) and compiling the GLFW + OpenGl3 demo using
- the system packages with the command below:
+ There seems to be some problem with using the packaged version ImGui together 
with GLFW. As an example, cloning the original repository
+ (https://github.com/ocornut/imgui) and compiling the GLFW + OpenGl3 demo 
using the system packages with the command below:
  
  ```
  g++ -ggdb -I/usr/include/imgui/backends $(pkg-config imgui --cflags) main.cpp 
-o test $(pkg-config imgui --libs --static) $(pkg-config glfw3 --libs --static) 
$(pkg-config glew --libs --static)
  ./test
  ```
  
  Yields a crash with the messages:
  
  ```
  malloc(): unsorted double linked list corrupted
  Aborted (core dumped)
  ```
  
  Which presumably means that we (or imgui) is accidentally overwriting some
- important `malloc` datastructures. Running it through valgrind yields a bit
- more, the full log of which has been attached to this ticket. Of particular
- interest are the lines:
+ important `malloc` datastructures. Running it through valgrind yields a bit 
more, the full log of which has been attached to this ticket. Of particular 
interest are the lines:
  
  ```
  ==88620== Conditional jump or move depends on uninitialised value(s)
  ==88620==    at 0x489E32F: ??? (in /usr/lib/x86_64-linux-gnu/libstb.so.0.0)
  ==88620==    by 0x4D5561B: msort_with_tmp.part.0 (msort.c:104)
  ==88620==    by 0x4D55A55: msort_with_tmp (msort.c:44)
  ==88620==    by 0x4D55A55: qsort_r (msort.c:296)
  ==88620==    by 0x48A66F0: stbrp_pack_rects (in 
/usr/lib/x86_64-linux-gnu/libstb.so.0.0)
  ==88620==    by 0x15D342: ImFontAtlasBuildPackCustomRects(ImFontAtlas*, 
void*) (in /home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x160E27: ImFontAtlasBuildWithStbTruetype(ImFontAtlas*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15EC9C: ImFontAtlas::GetTexDataAsAlpha8(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15ED46: ImFontAtlas::GetTexDataAsRGBA32(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FBCB: ImGui_ImplOpenGL3_CreateFontsTexture() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FF9A: ImGui_ImplOpenGL3_CreateDeviceObjects() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10D974: main (main.cpp:110)
  ==88620==  Uninitialised value was created by a heap allocation
  ==88620==    at 0x4847899: malloc (in 
/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==88620==    by 0x15D2D1: ImFontAtlasBuildPackCustomRects(ImFontAtlas*, 
void*) (in /home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x160E27: ImFontAtlasBuildWithStbTruetype(ImFontAtlas*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15EC9C: ImFontAtlas::GetTexDataAsAlpha8(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15ED46: ImFontAtlas::GetTexDataAsRGBA32(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FBCB: ImGui_ImplOpenGL3_CreateFontsTexture() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FF9A: ImGui_ImplOpenGL3_CreateDeviceObjects() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10D974: main (main.cpp:110)
  ```
  
- Which implies something in the texture atlas-building goes wrong, but I'm not
- familiar enough with the details here to offer a good opinion.
+ Which implies something in the texture atlas-building goes wrong, but
+ I'm not familiar enough with the details here to offer a good opinion.
  
  It's plausible that this is the same bug as reported in
- https://bugs.launchpad.net/ubuntu/+source/imgui/+bug/1963556 , but I have not
- been able to confirm that.
+ https://bugs.launchpad.net/ubuntu/+source/imgui/+bug/1963556 , but I
+ have not been able to confirm that.
  
- Admittedly, this is when running on the upcoming Xubuntu 22.04, so it may be a
- beta-release bug, /however/, compiling and running the cloned version of imgui
- directly works just fine.
+ Admittedly, this is when running on the upcoming Xubuntu 22.04, so it
+ may be a beta-release bug, /however/, compiling and running the cloned
+ version of imgui directly works just fine.

** Description changed:

  There seems to be some problem with using the packaged version ImGui together 
with GLFW. As an example, cloning the original repository
  (https://github.com/ocornut/imgui) and compiling the GLFW + OpenGl3 demo 
using the system packages with the command below:
  
  ```
  g++ -ggdb -I/usr/include/imgui/backends $(pkg-config imgui --cflags) main.cpp 
-o test $(pkg-config imgui --libs --static) $(pkg-config glfw3 --libs --static) 
$(pkg-config glew --libs --static)
  ./test
  ```
  
  Yields a crash with the messages:
  
  ```
  malloc(): unsorted double linked list corrupted
  Aborted (core dumped)
  ```
  
- Which presumably means that we (or imgui) is accidentally overwriting some
+ Which presumably means that the application (or imgui) is accidentally 
overwriting some
  important `malloc` datastructures. Running it through valgrind yields a bit 
more, the full log of which has been attached to this ticket. Of particular 
interest are the lines:
  
  ```
  ==88620== Conditional jump or move depends on uninitialised value(s)
  ==88620==    at 0x489E32F: ??? (in /usr/lib/x86_64-linux-gnu/libstb.so.0.0)
  ==88620==    by 0x4D5561B: msort_with_tmp.part.0 (msort.c:104)
  ==88620==    by 0x4D55A55: msort_with_tmp (msort.c:44)
  ==88620==    by 0x4D55A55: qsort_r (msort.c:296)
  ==88620==    by 0x48A66F0: stbrp_pack_rects (in 
/usr/lib/x86_64-linux-gnu/libstb.so.0.0)
  ==88620==    by 0x15D342: ImFontAtlasBuildPackCustomRects(ImFontAtlas*, 
void*) (in /home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x160E27: ImFontAtlasBuildWithStbTruetype(ImFontAtlas*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15EC9C: ImFontAtlas::GetTexDataAsAlpha8(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15ED46: ImFontAtlas::GetTexDataAsRGBA32(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FBCB: ImGui_ImplOpenGL3_CreateFontsTexture() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FF9A: ImGui_ImplOpenGL3_CreateDeviceObjects() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10D974: main (main.cpp:110)
  ==88620==  Uninitialised value was created by a heap allocation
  ==88620==    at 0x4847899: malloc (in 
/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==88620==    by 0x15D2D1: ImFontAtlasBuildPackCustomRects(ImFontAtlas*, 
void*) (in /home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x160E27: ImFontAtlasBuildWithStbTruetype(ImFontAtlas*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15EC9C: ImFontAtlas::GetTexDataAsAlpha8(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15ED46: ImFontAtlas::GetTexDataAsRGBA32(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FBCB: ImGui_ImplOpenGL3_CreateFontsTexture() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FF9A: ImGui_ImplOpenGL3_CreateDeviceObjects() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10D974: main (main.cpp:110)
  ```
  
  Which implies something in the texture atlas-building goes wrong, but
  I'm not familiar enough with the details here to offer a good opinion.
  
  It's plausible that this is the same bug as reported in
  https://bugs.launchpad.net/ubuntu/+source/imgui/+bug/1963556 , but I
  have not been able to confirm that.
  
  Admittedly, this is when running on the upcoming Xubuntu 22.04, so it
  may be a beta-release bug, /however/, compiling and running the cloned
  version of imgui directly works just fine.

** Description changed:

  There seems to be some problem with using the packaged version ImGui together 
with GLFW. As an example, cloning the original repository
  (https://github.com/ocornut/imgui) and compiling the GLFW + OpenGl3 demo 
using the system packages with the command below:
  
  ```
  g++ -ggdb -I/usr/include/imgui/backends $(pkg-config imgui --cflags) main.cpp 
-o test $(pkg-config imgui --libs --static) $(pkg-config glfw3 --libs --static) 
$(pkg-config glew --libs --static)
  ./test
  ```
  
  Yields a crash with the messages:
  
  ```
  malloc(): unsorted double linked list corrupted
  Aborted (core dumped)
  ```
  
- Which presumably means that the application (or imgui) is accidentally 
overwriting some
- important `malloc` datastructures. Running it through valgrind yields a bit 
more, the full log of which has been attached to this ticket. Of particular 
interest are the lines:
+ Which presumably means that the application (or imgui) is accidentally
+ overwriting some important `malloc` datastructures. Running it through
+ valgrind yields a bit more, the full log of which has been attached to
+ this ticket. Of particular interest are the lines:
  
  ```
  ==88620== Conditional jump or move depends on uninitialised value(s)
  ==88620==    at 0x489E32F: ??? (in /usr/lib/x86_64-linux-gnu/libstb.so.0.0)
  ==88620==    by 0x4D5561B: msort_with_tmp.part.0 (msort.c:104)
  ==88620==    by 0x4D55A55: msort_with_tmp (msort.c:44)
  ==88620==    by 0x4D55A55: qsort_r (msort.c:296)
  ==88620==    by 0x48A66F0: stbrp_pack_rects (in 
/usr/lib/x86_64-linux-gnu/libstb.so.0.0)
  ==88620==    by 0x15D342: ImFontAtlasBuildPackCustomRects(ImFontAtlas*, 
void*) (in /home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x160E27: ImFontAtlasBuildWithStbTruetype(ImFontAtlas*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15EC9C: ImFontAtlas::GetTexDataAsAlpha8(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15ED46: ImFontAtlas::GetTexDataAsRGBA32(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FBCB: ImGui_ImplOpenGL3_CreateFontsTexture() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FF9A: ImGui_ImplOpenGL3_CreateDeviceObjects() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10D974: main (main.cpp:110)
  ==88620==  Uninitialised value was created by a heap allocation
  ==88620==    at 0x4847899: malloc (in 
/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==88620==    by 0x15D2D1: ImFontAtlasBuildPackCustomRects(ImFontAtlas*, 
void*) (in /home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x160E27: ImFontAtlasBuildWithStbTruetype(ImFontAtlas*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15EC9C: ImFontAtlas::GetTexDataAsAlpha8(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x15ED46: ImFontAtlas::GetTexDataAsRGBA32(unsigned char**, 
int*, int*, int*) (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FBCB: ImGui_ImplOpenGL3_CreateFontsTexture() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10FF9A: ImGui_ImplOpenGL3_CreateDeviceObjects() (in 
/home/gustaf/git/phd/github/imgui/examples/example_glfw_opengl3/test)
  ==88620==    by 0x10D974: main (main.cpp:110)
  ```
  
  Which implies something in the texture atlas-building goes wrong, but
  I'm not familiar enough with the details here to offer a good opinion.
  
  It's plausible that this is the same bug as reported in
  https://bugs.launchpad.net/ubuntu/+source/imgui/+bug/1963556 , but I
  have not been able to confirm that.
  
  Admittedly, this is when running on the upcoming Xubuntu 22.04, so it
  may be a beta-release bug, /however/, compiling and running the cloned
  version of imgui directly works just fine.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1964127

Title:
  Imgui + GLFW-OpenGL3 Examples Segfaults

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/imgui/+bug/1964127/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to