Extend check for integer overflow for malloc argument to take into account