Fix memNeed overflow

Otherwise a function such as log can have offset = 2**256-1 and size 1, and the memNeed function would result in 0. This leads to segmentation fault and aborts the client.