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

WindowsAnsiOutputStream.processDownCursor overflows #69

Closed
lacasseio opened this issue Jan 10, 2017 · 3 comments · Fixed by gradle/gradle#1155
Closed

WindowsAnsiOutputStream.processDownCursor overflows #69

lacasseio opened this issue Jan 10, 2017 · 3 comments · Fixed by gradle/gradle#1155

Comments

@lacasseio
Copy link
Contributor

The method processDownCursor can overflow the cursor position by potentially setting the cursor to info.size.y which is an invalid position. This will cause an ERROR_INVALID_PARAMETER error to be returned from SetConsoleCursorPosition.

The solution (not yet tested) to this last issue would be to replace processCursorDown with the following code:

    protected void processCursorDown(int count) throws IOException {
        getConsoleInfo();
        info.cursorPosition.y = (short) Math.min(Math.max(0, info.size.y - 1), info.cursorPosition.y + count);
        applyCursorPosition();
    }

For more information, see this comment on gradle/gradle#882.

@lacasseio
Copy link
Contributor Author

@chirino Would you be willing to accept and pushing the previous fix quickly? This is blocking the gradle/gradle#882 for us and it would be a waste if we would need to fork the repo just to do the fix.

@lacasseio
Copy link
Contributor Author

I opened a PR that fix the problem.

@lacasseio
Copy link
Contributor Author

I will reopen as the issue still exists in Jansi, workaround was done in Gradle.

@lacasseio lacasseio reopened this Jan 14, 2017
@gnodet gnodet closed this as completed Mar 15, 2017
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

Successfully merging a pull request may close this issue.

2 participants