Skip to content

RDP/settings: avoid divide-by-zero when optimal client resolution is unavailable#681

Open
chrilep wants to merge 1 commit into
apache:mainfrom
chrilep:fix/rdp-optimal-resolution-sigfpe
Open

RDP/settings: avoid divide-by-zero when optimal client resolution is unavailable#681
chrilep wants to merge 1 commit into
apache:mainfrom
chrilep:fix/rdp-optimal-resolution-sigfpe

Conversation

@chrilep

@chrilep chrilep commented Jun 18, 2026

Copy link
Copy Markdown

Summary

This PR prevents a divide-by-zero in guac_rdp_parse_args() when client handshake data does not provide a valid optimal_resolution.

Problem

settings->width and settings->height were derived using:

  • ... / user->info.optimal_resolution

If optimal_resolution is 0, this can trigger SIGFPE.

Change

  • Guard width/height derivation with if (user->info.optimal_resolution > 0)
  • Fall back to defaults (RDP_DEFAULT_WIDTH, RDP_DEFAULT_HEIGHT) otherwise

Behavior

  • Existing behavior remains unchanged for valid optimal_resolution
  • Invalid/absent resolution metadata now degrades safely to defaults instead of crashing

Scope

Focused bugfix only; no protocol or feature changes.

AI Assistance Disclosure

Parts of this contribution (analysis and code drafting) were created with assistance from GitHub Copilot (GPT-5.3-Codex) and then reviewed/refined before submission.

@necouchman

Copy link
Copy Markdown
Contributor

@chrilep As with #680, you will need a Jira issue and to update PR title and commit messages with that Jira issue.

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 this pull request may close these issues.

2 participants