Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -23,12 +23,10 @@ #include #include #include -#include - #ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_ARPA_INET_H # include @@ -809,11 +807,11 @@ } # endif #endif /* Get rid of a warning, never reached anyway */ - assert(0); + OF_ENSURE(0); } - (bool)isListening { return _listening; Index: src/runtime/class.m ================================================================== --- src/runtime/class.m +++ src/runtime/class.m @@ -18,12 +18,10 @@ #include #include #include -#include - #import "runtime.h" #import "runtime-private.h" static struct objc_hashtable *classes = NULL; static Class *load_queue = NULL; Index: src/runtime/hashtable.m ================================================================== --- src/runtime/hashtable.m +++ src/runtime/hashtable.m @@ -19,12 +19,10 @@ #include #include #include #include -#include - #import "runtime.h" #import "runtime-private.h" uint32_t objc_hash_string(const char *str) @@ -72,17 +70,20 @@ { uint32_t i, hash, last; struct objc_hashtable_bucket *bucket; hash = objc_hash_string(key); - assert(h->count + 1 <= UINT32_MAX / 4); + + if (h->count + 1 > UINT32_MAX / 4) + OBJC_ERROR("Integer overflow!"); if ((h->count + 1) * 4 / (h->last_idx + 1) >= 3) { struct objc_hashtable_bucket **ndata; uint32_t nsize = (h->last_idx + 1) * 2; - assert(nsize > 0); + if (nsize == 0) + OBJC_ERROR("Integer overflow!"); ndata = malloc(nsize * sizeof(struct objc_hashtable_bucket*)); if (ndata == NULL) OBJC_ERROR("Not enough memory to insert into hash " "table!"); Index: tests/OFHTTPClientTests.m ================================================================== --- tests/OFHTTPClientTests.m +++ tests/OFHTTPClientTests.m @@ -18,12 +18,10 @@ #include #include #include -#include - #import "OFHTTPClient.h" #import "OFHTTPRequest.h" #import "OFHTTPRequestReply.h" #import "OFString.h" #import "OFTCPSocket.h" @@ -62,21 +60,21 @@ [cond unlock]; client = [listener accept]; if (![[client readLine] isEqual: @"GET /foo HTTP/1.1"]) - assert(0); + OF_ENSURE(0); if (![[client readLine] isEqual: [OFString stringWithFormat: @"Host: 127.0.0.1:%" @PRIu16, port]]) - assert(0); + OF_ENSURE(0); if (![[client readLine] hasPrefix: @"User-Agent:"]) - assert(0); + OF_ENSURE(0); if (![[client readLine] isEqual: @""]) - assert(0); + OF_ENSURE(0); [client writeString: @"HTTP/1.0 200 OK\r\n" @"cONTeNT-lENgTH: 7\r\n" @"\r\n" @"foo\n"