w.r.t. https://trac.osgeo.org/gdal/changeset/38405

Exactly why is it okay to resize this fixed size structure?

typedef struct {
    CPLErrorNum nLastErrNo;
    CPLErr  eLastErrType;
    CPLErrorHandlerNode *psHandlerStack;
    int     nLastErrMsgMax;
    int     nFailureIntoWarning;
    char    szLastErrMsg[DEFAULT_LAST_ERR_MSG_SIZE];
    // Do not add anything here. szLastErrMsg must be the last field.
    // See CPLRealloc() below.
} CPLErrorContext;

Your comment is:

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 ​
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1628. Credit to OSS
Fuz
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to