the infinite while loop in the source is added by me.
$sudo cat /home/jeffrin/beautifulwork/knowledge/debian/bug/657681/iof.c > /* content from https://www.geeksforgeeks.org/check-for-integer-overflow/ > */ > > #include<stdio.h> > #include<limits.h> > #include<stdlib.h> > > int addOvf(int* result, int a, int b) > { > if( a > INT_MAX - b) > return -1; > else > { > *result = a + b; > return 0; > } > } > > int main() > { > int *res = (int *)malloc(sizeof(int)); > int x = 2147483640; > int y = 10; > while (1) { > printf("%d", addOvf(res, x, y)); > printf("\n %d", *res); > } > getchar(); > return 0; > } > $ > > >