Carve_path in image.c boudery cases

Should we consider the cases where the cases where img == NULL or w > img.w? or did I think too much …we can always assume that the image will not be empty and the image width will always be wilder than w.

You do not lose anything by covering the special cases.
It makes the application more robust and easier debuggable.

An appropriate behavior might be an exit(EXIT_FAILURE).
You could also use assert for more concise code.

I see, thanks for your help :+1:

Some functions do have assumptions in the documentation of the code like: “Parameter z is assumed to be greater/less … than …”
You can rely on these assumptions – if you are yourself complying with them:
In other words the tests itself will not call one of your functions with arguments that do not comply with the stated assumptions, but if the function is called by another function you have implemented, and these have no guarantees like that, they may be called indirectly with an invalid argument.