i cannot repeat any problem from the issue using c++:
for (int h :{3,4,5,6,7,8,9}) {
for (int w :{5,6,7,8,9,10}) {
Mat m(h,w,CV_8U,Scalar(0));
m(Rect(w-3,h-1,3,1)) = 1;
//cout << m << endl;
Rect r = maskBoundingRect(m); // see post above
Rect r2 = boundingRect(m);
cout << (r==r2) << " " << r << r2 << endl;
}
}