<div dir="ltr">w.r.t. <a href="https://trac.osgeo.org/gdal/changeset/38405">https://trac.osgeo.org/gdal/changeset/38405</a><div><br></div><div>Exactly why is it okay to resize this fixed size structure?</div><div><br clear="all"><div><div>typedef struct {</div><div> CPLErrorNum nLastErrNo;</div><div> CPLErr eLastErrType;</div><div> CPLErrorHandlerNode *psHandlerStack;</div><div> int nLastErrMsgMax;</div><div> int nFailureIntoWarning;</div><div> char szLastErrMsg[DEFAULT_LAST_ERR_MSG_SIZE];</div><div> // Do not add anything here. szLastErrMsg must be the last field.</div><div> // See CPLRealloc() below.</div><div>} CPLErrorContext;</div></div><div><br></div><div>Your comment is:</div><div><br></div><div>CPLErrorSetState(): Workaround clang -fsanitize=undefined behaviour that doesn't like dereferencing szLastErrMsg[i>=DEFAULT_LAST_ERR_MSG_SIZE] even when structure has been properly resize. Fixes <a href="https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1628">https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1628</a>. Credit to OSS Fuz<br></div>
</div></div>