dieortin opened a new pull request, #59: URL: https://github.com/apache/xerces-c/pull/59
The Undefined Behavior Sanitizer detects undefined behavior in `ElemStack::expandStack`. This is due to `memcpy` being called with NULL as one of its parameters when `toExpand->fMap` is NULL, which works (the size parameter is 0) but is undefined behavior. This is fixed by doing a simple check for null before calling `memcpy`. If the object we wanted to copy from was null, we do not copy at all and the result is the same. This avoids the UBSan being triggered, and potential issues with compiler optimizations (as both pointer arguments to `memcpy` are marked as `__nonnull`) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org For additional commands, e-mail: c-dev-h...@xerces.apache.org