Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verilator/SDL Screen Array Unchecked (C++) #90

Open
WillGreen opened this issue Feb 7, 2022 · 0 comments
Open

Verilator/SDL Screen Array Unchecked (C++) #90

WillGreen opened this issue Feb 7, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@WillGreen
Copy link
Contributor

We don't check the SDL/Verilator screenbuffer array index is valid.

Pixel screenbuffer[H_RES*V_RES];

// update pixel if not in blanking interval
if (top->sdl_de) {
      Pixel* p = &screenbuffer[top->sdl_sy*H_RES + top->sdl_sx];
      p->a = 0xFF;  // transparency
      p->b = top->sdl_b;
      p->g = top->sdl_g;
      p->r = top->sdl_r;
  }

An invalid index will corrupt the simulation or (more likely) cause a core dump.

The display signals module should never set sdl_de high with an invalid sdl_sy or sdl_sx, but we shouldn't assume this.

@WillGreen WillGreen added the bug Something isn't working label Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant