Two reasons caused the crash.
- The buffer pointer is referenced first, then the buffer is reallocated and the original pointer is reused.
- gpd->runtime.sbuffer_size is a short and can be clamped to negative values.
I solved these two reasons and added a NULL check for more safeness.
Ref T71260