Incorrect CreateUninitializedVector documentation [C++]
23scurtu opened this issue · comments
The documentation for CreateUninitializedVector seems to be incorrect. Particularly this line:
Write the data any time later to the returned buffer pointer
buf
buf
can be invalidated by subsequent calls to FlatBufferBuilder methods. For example, if calling CreateUninitializedVector twice such as when creating a flatbuffer that contains two vectors, the first buf
may be invalidated if a reallocation is triggered inside CreateUninitializedVector. This natural usage easily leads to heap corruption. At the very least, the documentation for both CreateUninitializedVector [1/2] and [2/2] should be changed to have warnings about buf
's invalidation.
Thanks.