122122
123123#define NANOVDB_MAJOR_VERSION_NUMBER 32 // reflects changes to the ABI and hence also the file format
124124#define NANOVDB_MINOR_VERSION_NUMBER 4 // reflects changes to the API but not ABI
125- #define NANOVDB_PATCH_VERSION_NUMBER 0 // reflects changes that does not affect the ABI or API
125+ #define NANOVDB_PATCH_VERSION_NUMBER 1 // reflects changes that does not affect the ABI or API
126126
127127// This replaces a Coord key at the root level with a single uint64_t
128128#define USE_SINGLE_ROOT_KEY
@@ -161,7 +161,7 @@ typedef unsigned long long uint64_t;
161161#include < stdint.h> // for types like int32_t etc
162162#include < stddef.h> // for size_t type
163163#include < cassert> // for assert
164- #include < cstdio> // for sprinf
164+ #include < cstdio> // for snprintf
165165#include < cmath> // for sqrt and fma
166166#include < limits> // for numeric_limits
167167#include < utility> // for std::move
@@ -673,8 +673,8 @@ class Version
673673#ifndef __CUDACC_RTC__
674674 const char * c_str () const
675675 {
676- char *buffer = (char *)malloc (4 + 1 + 4 + 1 + 4 + 1 );// xxxx.xxxx.xxxx\n
677- sprintf (buffer, " %d.%d.%d" , this ->getMajor (), this ->getMinor (), this ->getPatch ());
676+ char *buffer = (char *)malloc (4 + 1 + 4 + 1 + 4 + 1 );// xxxx.xxxx.xxxx\0
677+ snprintf (buffer, 4 + 1 + 4 + 1 + 4 + 1 , " %d.%d.%d" , this ->getMajor (), this ->getMinor (), this ->getPatch ()); // Prevents overflows by enforcing a fixed size of buffer
678678 return buffer;
679679 }
680680#endif
@@ -5688,7 +5688,7 @@ void writeUncompressedGrid(StreamT &os, const void *buffer)
56885688 if (*(const uint32_t *)(grid+24 ) >= *(const uint32_t *)(grid+28 ) - 1 ) break ;
56895689 grid += gridSize;
56905690 }
5691- }
5691+ }// writeUncompressedGrid
56925692
56935693// / @brief write multiple NanoVDB grids to a single file, without compression.
56945694template <typename GridHandleT, template <typename ...> class VecT >
@@ -5709,7 +5709,7 @@ void writeUncompressedGrids(const char* fileName, const VecT<GridHandleT>& handl
57095709 fprintf (stderr, " nanovdb::writeUncompressedGrids: Unable to open file \" %s\" for output\n " ,fileName); exit (EXIT_FAILURE);
57105710 }
57115711 for (auto &handle : handles) writeUncompressedGrid (os, handle.data ());
5712- }
5712+ }// writeUncompressedGrids
57135713
57145714// / @brief read all uncompressed grids from a stream and return their handles.
57155715// /
@@ -5741,7 +5741,7 @@ VecT<GridHandleT> readUncompressedGrids(StreamT& is, const typename GridHandleT:
57415741 }
57425742 }
57435743 return handles;
5744- }
5744+ }// readUncompressedGrids
57455745
57465746// / @brief Read a multiple un-compressed NanoVDB grids from a file and return them as a vector.
57475747template <typename GridHandleT, template <typename ...> class VecT >
@@ -5767,7 +5767,7 @@ VecT<GridHandleT> readUncompressedGrids(const char *fileName, const typename Gri
57675767 fprintf (stderr, " nanovdb::readUncompressedGrids: Unable to open file \" %s\" for input\n " ,fileName); exit (EXIT_FAILURE);
57685768 }
57695769 return readUncompressedGrids<GridHandleT, StreamT, VecT>(is, buffer);
5770- }
5770+ }// readUncompressedGrids
57715771
57725772} // namespace io
57735773
0 commit comments