Menu

#707 memory leaks in gm

v1.0_(example)
closed-fixed
None
5
2023-04-15
2023-04-09
babybus
No

We found a bug on the latest release of GM.

Command Input

gm convert poc_file /dev/null

poc_file are attached.

Sanitizer Dump

==2888300==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 512 byte(s) in 2 object(s) allocated from:
    #0 0x7fe01a10c808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
    #1 0x56079d99d7d5 in MagickMalloc magick/memory.c:175
    #2 0x56079da5b098 in AllocateString magick/utility.c:202
    #3 0x56079de2eeef in SetImageAttribute magick/attribute.c:3219
    #4 0x56079dc4b94c in ReadMIFFImage coders/miff.c:1366
    #5 0x56079d929abc in ReadImage magick/constitute.c:1682
    #6 0x56079d8c33e8 in ConvertImageCommand magick/command.c:4478
    #7 0x56079d8db69f in MagickCommand magick/command.c:8983
    #8 0x56079d90a1a7 in GMCommandSingle magick/command.c:17563
    #9 0x56079d90a4b5 in GMCommand magick/command.c:17616
    #10 0x56079d8adcbc in main utilities/gm.c:61
    #11 0x7fe019666082 in __libc_start_main ../csu/libc-start.c:308

Indirect leak of 256 byte(s) in 1 object(s) allocated from:
    #0 0x7fe01a10c808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
    #1 0x56079d99d7d5 in MagickMalloc magick/memory.c:175
    #2 0x56079da5b098 in AllocateString magick/utility.c:202
    #3 0x56079de2eeef in SetImageAttribute magick/attribute.c:3219
    #4 0x56079dc49a96 in ReadMIFFImage coders/miff.c:1138
    #5 0x56079d929abc in ReadImage magick/constitute.c:1682
    #6 0x56079d8c33e8 in ConvertImageCommand magick/command.c:4478
    #7 0x56079d8db69f in MagickCommand magick/command.c:8983
    #8 0x56079d90a1a7 in GMCommandSingle magick/command.c:17563
    #9 0x56079d90a4b5 in GMCommand magick/command.c:17616
    #10 0x56079d8adcbc in main utilities/gm.c:61
    #11 0x7fe019666082 in __libc_start_main ../csu/libc-start.c:308

Indirect leak of 80 byte(s) in 2 object(s) allocated from:
    #0 0x7fe01a10c808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
    #1 0x56079d99d7d5 in MagickMalloc magick/memory.c:175
    #2 0x56079de2eece in SetImageAttribute magick/attribute.c:3216
    #3 0x56079dc4b94c in ReadMIFFImage coders/miff.c:1366
    #4 0x56079d929abc in ReadImage magick/constitute.c:1682
    #5 0x56079d8c33e8 in ConvertImageCommand magick/command.c:4478
    #6 0x56079d8db69f in MagickCommand magick/command.c:8983
    #7 0x56079d90a1a7 in GMCommandSingle magick/command.c:17563
    #8 0x56079d90a4b5 in GMCommand magick/command.c:17616
    #9 0x56079d8adcbc in main utilities/gm.c:61
    #10 0x7fe019666082 in __libc_start_main ../csu/libc-start.c:308

Indirect leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fe01a10c808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
    #1 0x56079d99d7d5 in MagickMalloc magick/memory.c:175
    #2 0x56079de2eece in SetImageAttribute magick/attribute.c:3216
    #3 0x56079dc49a96 in ReadMIFFImage coders/miff.c:1138
    #4 0x56079d929abc in ReadImage magick/constitute.c:1682
    #5 0x56079d8c33e8 in ConvertImageCommand magick/command.c:4478
    #6 0x56079d8db69f in MagickCommand magick/command.c:8983
    #7 0x56079d90a1a7 in GMCommandSingle magick/command.c:17563
    #8 0x56079d90a4b5 in GMCommand magick/command.c:17616
    #9 0x56079d8adcbc in main utilities/gm.c:61
    #10 0x7fe019666082 in __libc_start_main ../csu/libc-start.c:308

Indirect leak of 12 byte(s) in 1 object(s) allocated from:
    #0 0x7fe01a10c808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
    #1 0x56079d99d7d5 in MagickMalloc magick/memory.c:175
    #2 0x56079de2f088 in SetImageAttribute magick/attribute.c:3246
    #3 0x56079dc49a96 in ReadMIFFImage coders/miff.c:1138
    #4 0x56079d929abc in ReadImage magick/constitute.c:1682
    #5 0x56079d8c33e8 in ConvertImageCommand magick/command.c:4478
    #6 0x56079d8db69f in MagickCommand magick/command.c:8983
    #7 0x56079d90a1a7 in GMCommandSingle magick/command.c:17563
    #8 0x56079d90a4b5 in GMCommand magick/command.c:17616
    #9 0x56079d8adcbc in main utilities/gm.c:61
    #10 0x7fe019666082 in __libc_start_main ../csu/libc-start.c:308

Indirect leak of 10 byte(s) in 2 object(s) allocated from:
    #0 0x7fe01a10c808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
    #1 0x56079d99d7d5 in MagickMalloc magick/memory.c:175
    #2 0x56079de2f088 in SetImageAttribute magick/attribute.c:3246
    #3 0x56079dc4b94c in ReadMIFFImage coders/miff.c:1366
    #4 0x56079d929abc in ReadImage magick/constitute.c:1682
    #5 0x56079d8c33e8 in ConvertImageCommand magick/command.c:4478
    #6 0x56079d8db69f in MagickCommand magick/command.c:8983
    #7 0x56079d90a1a7 in GMCommandSingle magick/command.c:17563
    #8 0x56079d90a4b5 in GMCommand magick/command.c:17616
    #9 0x56079d8adcbc in main utilities/gm.c:61
    #10 0x7fe019666082 in __libc_start_main ../csu/libc-start.c:308

SUMMARY: AddressSanitizer: 910 byte(s) leaked in 9 allocation(s).

Environment

  • OS: Ubuntu 20.04.1
    -gcc:9.4.0
  • GraphicsMagick: GraphicsMagick-1.3.40

we built GraphicsMagick with AddressSanitizer (ASAN) .

CC       = gcc
  CFLAGS   = -fopenmp -g -O0 -fsanitize=address -Wall -pthread
  CPPFLAGS = -I/usr/include/freetype2 -I/usr/include/libxml2
  CXX      = g++
  CXXFLAGS = -g -O0 -fsanitize=address -pthread
  DEFS     = -DHAVE_CONFIG_H
  LDFLAGS  = 
  LIBS     = -ljbig -lwebp -lwebpmux -ltiff -lfreetype -ljpeg -lpng16 -lXext -lSM -lICE -lX11 -llzma -lbz2 -lxml2 -lz -lm -lpthread
1 Attachments

Discussion

  • Bob Friesenhahn

    Bob Friesenhahn - 2023-04-09
    • assigned_to: Bob Friesenhahn
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2023-04-10

    FYI, I am able to reproduce this issue.

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2023-04-15
    • status: open --> closed-fixed
    • private: Yes --> No
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2023-04-15

    This bug is resolved by Mercurial changeset 17025:3ce01217413b and is included in the 1.4.020230402 development snapshot. A rewrite of SetImageAttribute() can be saved for later.

     

Log in to post a comment.

MongoDB Logo MongoDB