[RFC] coverity/74717: FP: NULL Pointer Dereference

dynamic_buffer_ensure() allocates buf->data; add an assert to make this clear to coverity.
`realloc` could free memory with a length argument of zero, but `xrealloc` cannot. We always get a pointer to at least one byte of allocated memory.