Commit a030777f authored by Gerald Pfeifer's avatar Gerald Pfeifer Committed by Alexandre Julliard

msvcrt: Fix error handling in _aligned_offset_realloc().

parent 00a961c5
...@@ -443,13 +443,14 @@ void * CDECL _aligned_offset_realloc(void *memblock, MSVCRT_size_t size, ...@@ -443,13 +443,14 @@ void * CDECL _aligned_offset_realloc(void *memblock, MSVCRT_size_t size,
/* It seems this function was called with an invalid pointer. Bail out. */ /* It seems this function was called with an invalid pointer. Bail out. */
return NULL; return NULL;
} }
/* Adjust old_size to get amount of actual data in old block. */ /* Adjust old_size to get amount of actual data in old block. */
old_size -= old_padding; if (old_size < old_padding)
if (old_size < 0)
{ {
/* Shouldn't happen. Something's weird, so bail out. */ /* Shouldn't happen. Something's weird, so bail out. */
return NULL; return NULL;
} }
old_size -= old_padding;
temp = MSVCRT_realloc(*saved, size + alignment + sizeof(void *)); temp = MSVCRT_realloc(*saved, size + alignment + sizeof(void *));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment