forked from len0rd/rockbox
matrix plugin: Fix out-of-bounds array access. Unify for-loop style.
Change-Id: I74ec8e559b80bee6c7de02193e943244dcf352c4
This commit is contained in:
parent
4613ffae8a
commit
0fd04941a3
1 changed files with 5 additions and 5 deletions
|
|
@ -88,14 +88,14 @@ static void matrix_init(void) {
|
||||||
rb->srand(*rb->current_tick);
|
rb->srand(*rb->current_tick);
|
||||||
|
|
||||||
/* Make the matrix */
|
/* Make the matrix */
|
||||||
for (i = 0; i <= ROWS; i++) {
|
for (i = 0; i < ROWS; i++) {
|
||||||
for (j = 0; j <= COLS - 1; j++ ) {
|
for (j = 0; j < COLS; j++) {
|
||||||
matrix[i][j].val = -1;
|
matrix[i][j].val = -1;
|
||||||
matrix[i][j].bold = 0;
|
matrix[i][j].bold = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j <= COLS - 1; j++) {
|
for (j = 0; j < COLS; j++) {
|
||||||
/* Set up spaces[] array of how many spaces to skip */
|
/* Set up spaces[] array of how many spaces to skip */
|
||||||
spaces[j] = rb->rand() % ROWS + 1;
|
spaces[j] = rb->rand() % ROWS + 1;
|
||||||
|
|
||||||
|
|
@ -139,7 +139,7 @@ static void matrix_loop(void)
|
||||||
if (count > 4)
|
if (count > 4)
|
||||||
count = 1;
|
count = 1;
|
||||||
|
|
||||||
for (j = 0; j <= COLS - 1; j++) {
|
for (j = 0; j < COLS; j++) {
|
||||||
if (count > updates[j]) {
|
if (count > updates[j]) {
|
||||||
/* New style scrolling */
|
/* New style scrolling */
|
||||||
if (matrix[0][j].val == -1 && matrix[1][j].val == 129
|
if (matrix[0][j].val == -1 && matrix[1][j].val == 129
|
||||||
|
|
@ -217,7 +217,7 @@ static void matrix_loop(void)
|
||||||
firstcoldone = 1;
|
firstcoldone = 1;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
for (i = 1; i <= ROWS; i++) {
|
for (i = 1; i < ROWS; i++) {
|
||||||
if (matrix[i][j].val == 0 || matrix[i][j].bold == 2) {
|
if (matrix[i][j].val == 0 || matrix[i][j].bold == 2) {
|
||||||
if (matrix[i][j].val == 0)
|
if (matrix[i][j].val == 0)
|
||||||
matrix_blit_char(i - 1, j, 20);
|
matrix_blit_char(i - 1, j, 20);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue