Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[OpenTK] Clamp max AA level to 64x

This protects against a potential denial-of-service issue during mode
selection, where the platform backend will try to reduce AA level until
a supported mode is found.
  • Loading branch information...
commit ff36f0f35a60e4fa38581eb6f24cac17f65cc71b 1 parent 2b6aec3
@thefiddler thefiddler authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 Source/OpenTK/Graphics/GraphicsMode.cs
View
9 Source/OpenTK/Graphics/GraphicsMode.cs
@@ -254,7 +254,14 @@ public int Samples
{
return samples;
}
- private set { samples = value; }
+ private set
+ {
+ // Clamp antialiasing samples to max 64x
+ // This protects against a potential DOS during
+ // mode selection, when the user requests an
+ // abnormally high AA level.
+ samples = MathHelper.Clamp(value, 0, 64);
+ }
}
#endregion
Please sign in to comment.
Something went wrong with that request. Please try again.