]> granicus.if.org Git - graphviz/commit
add utility function for turning integers into strings
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 5 May 2021 04:23:07 +0000 (21:23 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 11 May 2021 14:32:54 +0000 (07:32 -0700)
commit977ca93a9155ca92394bbc31def6388f129f534b
treeeb193a958889aa151d0e7790102c96bc8c24d4db
parent5b620771b7e5f07529ff7a41177ae27048c91865
add utility function for turning integers into strings

This is common operation within Graphviz. It is also a common source of bugs.
There have been numerous instances of ints being stringized into fixed sized
buffers that were not large enough to hold them. The result has been pernicious
memory safety issues that have been difficult to reproduce and root cause.¹

The hope is that this wrapper can provide a safe, efficient, and tested
alternative. Going forwards, the intent is to replace as many compatible
operations as possible with calls to this function.

  ¹ A user would report a crash that relied on their objects having large IDs or
    their platform having a large int width. The example would run fine in a
    different environment and mystify the maintainers.
lib/cgraph/CMakeLists.txt
lib/cgraph/Makefile.am
lib/cgraph/cgraph.vcxproj
lib/cgraph/cgraph.vcxproj.filters
lib/cgraph/itos.h [new file with mode: 0644]
lib/cgraph/test_itos.c [new file with mode: 0644]
rtest/test_itos.py [new file with mode: 0644]