[Tim] >> If we changed the test to use maxint // 2 instead, it would >> (just barely) trigger the >> >> _new_size <= ((~(size_t)0) / sizeof(type)) >> >> test in NRESIZE instead, and keep the platform realloc() out of it. >> >> Good enough? [Guido] > I'd say so, except I fear that it might cause different problems > (not that I know of any). I tried it on Linux and on Win98 > and it works fine. I presume you've tested it on Win2K. Not really, but I watched what it *would* have done <wink> in the debugger. > But wasn't it specifically designed to catch a condition that was > only true when the size was (approximately) maxint/4? If that was the intent, then Martin was right that it's not catching what it intended to catch: as written, it goes to the platform realloc. The only place it *could* get caught before going to the platform realloc is in the snippet of code from NRESIZE I included above. The suggested change would (just barely) trigger that code instead, and we wouldn't invoked the platform realloc() at all then. There are no other interesting conditions I know of, or can find in the code.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4