Not able to find error

Hello
I am doing this question on leetcode…
1277. Count Square Submatrices with All Ones

Here i am getting heap-overflow error in my code.
But i am not able to find the bug.
This is my code.


Could you please help me to find , why it is showing heap overflow error.
Thanks

@ashishnnnnn hey you have not checked the boundary constraints before calling recursion that is if you are calling on i,j+1 then they must be in limits, change that rest is looking fine.