From 41f1e88953de9d6e858dc2c5a3446d4a2de9b0b8 Mon Sep 17 00:00:00 2001 From: espie <> Date: Wed, 23 Apr 2014 10:47:15 +0000 Subject: [PATCH] explain a bit more what's going on for stupid me. okay otto@ --- src/lib/libc/stdlib/malloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 5db51d58..6c38d6ad 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.156 2014/04/23 05:43:25 otto Exp $ */ +/* $OpenBSD: malloc.c,v 1.157 2014/04/23 10:47:15 espie Exp $ */ /* * Copyright (c) 2008, 2010, 2011 Otto Moerbeek * Copyright (c) 2012 Matthew Dempsky @@ -1388,6 +1388,9 @@ realloc(void *ptr, size_t size) } +/* this is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW + */ #define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 4)) void *