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

malloc(): memory corruption on CvImage::toImageMsg #351

Closed
Pyrojambo opened this issue Aug 6, 2020 · 1 comment
Closed

malloc(): memory corruption on CvImage::toImageMsg #351

Pyrojambo opened this issue Aug 6, 2020 · 1 comment

Comments

@Pyrojambo
Copy link

I've encountered an error when using the following line of code, which runs in a loop to publish at 20Hz:
sensor_msgs::ImagePtr img_ptr = cv_bridge::CvImage(std_msgs::Header(), "bgr8", img).toImageMsg();

I've used GDB to try to get more information on it and got the following:

malloc(): memory corruption

Thread 1 "img_pub" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) info source
Current source file is ../sysdeps/unix/sysv/linux/raise.c
Compilation directory is /build/glibc-2ORdQG/glibc-2.27/signal
Source language is c.
Producer is GNU C11 7.5.0 -mtune=generic -march=x86-64 -g -O2 -O3 -std=gnu11 -fgnu89-inline -fmerge-all-constants -frounding-math -fstack-protector-strong -fPIC -ftls-model=initial-exec -fstack-protector-strong.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff52a78b1 in __GI_abort () at abort.c:79
#2 0x00007ffff52f0907 in __libc_message (action=action@entry=do_abort,
fmt=fmt@entry=0x7ffff541ddfa "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3 0x00007ffff52f797a in malloc_printerr (
str=str@entry=0x7ffff541c06e "malloc(): memory corruption")
at malloc.c:5350
#4 0x00007ffff52fba04 in _int_malloc (
av=av@entry=0x7ffff5652c40 <main_arena>, bytes=bytes@entry=1080000)
at malloc.c:3738
#5 0x00007ffff52fe35d in _GI___libc_malloc (bytes=1080000) at malloc.c:3065
#6 0x00007ffff5ca1298 in operator new(unsigned long) ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7 0x00007ffff71f4ed4 in cv_bridge::CvImage::toImageMsg(sensor_msgs::Image
<std::allocator >&) const () from /opt/ros/melodic/lib/libcv_bridge.so
#8 0x00007ffff71f5e7c in cv_bridge::CvImage::toImageMsg() const ()
from /opt/ros/melodic/lib/libcv_bridge.so
#9 0x00005555555a9d49 in ImgPub::publishImage (this=0x7fffffffb670)
at /home/james1/Documents/catkin_ws/src/img_pub/src/img_pub.cpp:447
#10 0x00005555555a9fb3 in ImgPub::publishOutputs (this=0x7fffffffb670)
at /home/james1/Documents/catkin_ws/src/img_pub/src/img_pub.cpp:468

My environment is:

  • Ubuntu 18.04
  • ROS Melodic
  • OpenCV 3.2.0
  • cv_bridge 1.13.0
@ijnek
Copy link
Member

ijnek commented Nov 17, 2024

Closing issue due to error reported on an EOL ROS distro. Please comment if this needs to be reopened.

@ijnek ijnek closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2024
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