Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • G graphviz
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 418
    • Issues 418
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 28
    • Merge requests 28
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • graphvizgraphviz
  • graphviz
  • Issues
  • #1700
You need to sign in or sign up before continuing.
Closed
Open
Issue created Apr 17, 2020 by le3d1ng@le3d1ng

[dot]heap-over-flow(off-by-null) in lib/common/shapes.c

tested on f8b9e035 / ubuntu 16.04 / clang / ASAN

Hi, I've came upon an heap-over-flow

parse_reclbl(lib/common/shapes.c:3311), you could trigger it by loading the content below with: dot filename

 digraph structs {
 struct [shape=record,label="<"];
 }

ASAN report:

==14380==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000001f2 at pc 0x7ffff79fa166 bp 0x7fffffffdc60 sp 0x7fffffffdc58
WRITE of size 1 at 0x6020000001f2 thread T0
    #0 0x7ffff79fa165 in parse_reclbl /root/graphviz/lib/common/shapes.c:3311:8
    #1 0x7ffff79ecd77 in record_init /root/graphviz/lib/common/shapes.c:3556:9
    #2 0x7ffff7a1a9e9 in common_init_node /root/graphviz/lib/common/utils.c:653:5
    #3 0x7ffff2b13c1d in dot_init_node /root/graphviz/lib/dotgen/dotinit.c:40:5
    #4 0x7ffff2b13c1d in dot_init_node_edge /root/graphviz/lib/dotgen/dotinit.c:81
    #5 0x7ffff2b1a4a4 in dotLayout /root/graphviz/lib/dotgen/dotinit.c:308:5
    #6 0x7ffff2b17517 in doDot /root/graphviz/lib/dotgen/dotinit.c:463:2
    #7 0x7ffff2b17517 in dot_layout /root/graphviz/lib/dotgen/dotinit.c:509
    #8 0x7ffff784e153 in gvLayoutJobs /root/graphviz/lib/gvc/gvlayout.c:85:2
    #9 0x516f3b in main /root/graphviz/cmd/dot/dot.c:132:6
    #10 0x7ffff65ff82f in __libc_start_main /build/glibc-LK5gWL/glibc-2.23/csu/../csu/libc-start.c:291
    #11 0x41aa58 in _start (/usr/local/bin/dot+0x41aa58)

0x6020000001f2 is located 0 bytes to the right of 2-byte region [0x6020000001f0,0x6020000001f2)
allocated by thread T0 here:
    #0 0x4dec88 in malloc (/usr/local/bin/dot+0x4dec88)
    #1 0x7ffff790efe4 in gmalloc /root/graphviz/lib/common/memory.c:47:10
    #2 0x7ffff790efe4 in zmalloc /root/graphviz/lib/common/memory.c:25

SUMMARY: AddressSanitizer: heap-buffer-overflow /root/graphviz/lib/common/shapes.c:3311:8 in parse_reclbl
Shadow bytes around the buggy address:
  0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff8000: fa fa 05 fa fa fa 00 03 fa fa 00 05 fa fa 00 fa
  0x0c047fff8010: fa fa 00 00 fa fa 00 00 fa fa fd fd fa fa fd fd
  0x0c047fff8020: fa fa 07 fa fa fa fd fd fa fa 00 01 fa fa 00 00
=>0x0c047fff8030: fa fa 00 fa fa fa 02 fa fa fa 02 fa fa fa[02]fa
  0x0c047fff8040: fa fa fd fa fa fa 00 fa fa fa fa fa fa fa fa fa
  0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==14380==ABORTING
Assignee
Assign to
Time tracking