Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 555dac5

Browse files
Weverythingidealisms
authored andcommitted
Fix a possible infinite loop by incrementing one of the variables used in the loop conditional.
This was detected by Richard Trieu when compiling with clang.
1 parent 79deb35 commit 555dac5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/_image.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,8 +1039,7 @@ _image_module::fromarray2(const Py::Tuple& args)
10391039
int rgba = A->dimensions[2] == 4;
10401040
double r, g, b, alpha;
10411041
const size_t N = imo->rowsIn * imo->colsIn;
1042-
size_t i = 0;
1043-
while (i < N)
1042+
for (size_t i = 0; i < N; ++i)
10441043
{
10451044
r = *(double *)(A->data++);
10461045
g = *(double *)(A->data++);

0 commit comments

Comments
 (0)