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

Randr's GetScreenInfo broken. #20

Open
snyh opened this issue Dec 31, 2013 · 1 comment
Open

Randr's GetScreenInfo broken. #20

snyh opened this issue Dec 31, 2013 · 1 comment

Comments

@snyh
Copy link
Contributor

snyh commented Dec 31, 2013

It seems an xserver bug.

Although only tested under xgb and xpyb, but xserver didn't send the rates field of GetScreenInfoReply.

This will cause panic.

I have report it to https://bugs.freedesktop.org/show_bug.cgi?id=73180

@tv42
Copy link

tv42 commented Feb 17, 2016

I'm seeing something similar with an out of bounds slice access in randr.RefreshRatesRead. This diff hides the problem for me:

diff --git i/randr/randr.go w/randr/randr.go
index 20dc62a..d0e35ac 100644
--- i/randr/randr.go
+++ w/randr/randr.go
@@ -1299,6 +1299,9 @@ type RefreshRates struct {

 // RefreshRatesRead reads a byte slice into a RefreshRates value.
 func RefreshRatesRead(buf []byte, v *RefreshRates) int {
+       if len(buf) == 0 {
+               return 0
+       }
        b := 0

        v.NRates = xgb.Get16(buf[b:])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants