util: skip zero-sized SHA1Update
Fixes UBSan error: src/util/sha1/sha1.c:140:8: runtime error: null pointer passed as argument 2, which is declared to never be null Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25853>
This commit is contained in:
@@ -44,7 +44,8 @@ _mesa_sha1_init(struct mesa_sha1 *ctx)
|
||||
static inline void
|
||||
_mesa_sha1_update(struct mesa_sha1 *ctx, const void *data, size_t size)
|
||||
{
|
||||
SHA1Update(ctx, (const unsigned char *)data, size);
|
||||
if (size)
|
||||
SHA1Update(ctx, (const unsigned char *)data, size);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
||||
Reference in New Issue
Block a user