[Mono-bugs] [Bug 79729][Cri] New - Integer Overflow/Underflow in GDI,

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Oct 23 18:55:00 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by david_garcia at logitech.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79729

--- shadow/79729	2006-10-23 18:55:00.000000000 -0400
+++ shadow/79729.tmp.6698	2006-10-23 18:55:00.000000000 -0400
@@ -0,0 +1,171 @@
+Bug#: 79729
+Product: Mono: Runtime
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Critical
+Component: io-layer
+AssignedTo: dick at ximian.com                            
+ReportedBy: david_garcia at logitech.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Integer Overflow/Underflow in GDI, 
+
+Environment:
+OS: 
+
+Ubuntu 2.6.15-26-server #1 SMP Fri Sep 8 21:00:37 UTC 2006 i686 GNU/Linux
+Bug occurs on other linux and unix systems (Solaris)
+Mono: 1.1.18
+
+Bug Description: 
+When an offset greater than x=16384, 2^14
+the clipping window starts to move, numbers before that,
+the window does not move
+
+Expected Results:
+Only the world would translate. Clipping window would not move.
+Items draw will be the only thing moving in clipping window.
+
+Actual Results:
+numbers used to draw before X is translated > 2^ 14 are translated properly
+without the clipping window moving.
+Numbers after X result in clipping window moving.
+
+//////////////////////////////////////Sample code below
+///////running on xsp2
+<%@ Page Language="C#" %>
+<%@ Import Namespace = "System.Drawing" %>
+<%@ Import Namespace = "System.Drawing.Drawing2D" %>
+<%@ Import Namespace = "System.IO" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
+Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
+transitional.dtd">
+
+<script runat="server">
+//internal object used to handle a bug in the GDI for linux/unix
+//because the VisibleClipBounds does not maintain its data correctly
+//on linux pertaining to the boundary of the clipping region/window
+    public enum Rotation : int
+    {
+        /// <summary>
+        /// a rotation level
+        /// </summary>
+        Degree0 = 0,
+        /// <summary>
+        ///  rotation 90 deg
+        /// </summary>
+        Degree90 = 90,
+        /// <summary>
+        ///  rotation 180 deg
+        /// </summary>
+        Degree180 = 180,
+        /// <summary>
+        ///  rotation 270 deg
+        /// </summary>
+
+        Degree270 = 270
+    }
+
+    protected void Page_Load(object sender, EventArgs e)
+    {
+
+
+        /*
+         * debug values from my custom lib
+         * anchor is offset in this example code below
+//############UNIX BUG FIX MODE True#####################
+Graph::Paint Anchor {X=100, Y=100}
+Graph::Paint RelativeCenter {X=-32318.08, Y=900}
+Graph::Paint Center {X=-32218.08, Y=1000}
+Graph::Paint Size {Width=900, Height=900}
+Graph::Paint Rotation Degree0
+//below calculated from Size Demensions - center + offset
+Graph::Paint Left 32318.08
+Graph::Paint Right 33218.08
+Graph::Paint Top -900
+Graph::Paint Bottom 0
+
+//############UNIX BUG FIX MODE False#####################
+Graph::Paint Anchor {X=100, Y=100}
+Graph::Paint RelativeCenter {X=0, Y=0}
+Graph::Paint Center {X=100, Y=100}
+Graph::Paint Size {Width=900, Height=900}
+Graph::Paint Rotation Degree0
+//below retrieved from GDI.VisibleClipBounds, 
+//these should be the same as above
+//regardless of the unix mode (OSVersion), on windows they are the same,
+//on unix/linux they are never the same
+//bug reported, never fixed
+Graph::Paint Left 0 
+Graph::Paint Right 1000
+Graph::Paint Top 0
+Graph::Paint Bottom 1000
+*/
+        //Step 1 :Create a GDI object from a Bitmap
+        Bitmap bmp=new Bitmap(1000,1000);
+        Graphics g=Graphics.FromImage(bmp);
+        //step 2: define the variables
+        //offset is also called anchor
+        PointF offset = new PointF(100, 100);
+        float center_x;
+
+        if (Request.QueryString["x"] != null)
+            center_x = Convert.ToSingle(Request.QueryString["x"]);
+        else
+            center_x = 10f;
+        
+        PointF center = new PointF(center_x, 500f);
+        Rotation angle = Rotation.Degree0;
+        SizeF size =new SizeF(900,900);
+       // Step 3: Apply a transofmration
+       
+        g.ResetTransform();
+        g.TranslateTransform(offset.X, offset.Y);
+        g.Clip = new Region(new RectangleF(
+                        0, 0,
+                        size.Width, size.Height));
+        g.RotateTransform((float)angle);//angle is type Rotation
+        g.TranslateTransform(center.X, center.Y, MatrixOrder.Append);
+        g.Clear(Color.Red);
+//step 4: draw 
+        g.DrawLine(Pens.Black, -500, -500, 500, 500);
+        g.DrawLine(Pens.Black, -500, 500, 500, -500);
+   
+          
+        Response.Clear();
+        Response.ContentType = "image/bmp";
+    
+        using (MemoryStream ms = new MemoryStream())
+        {
+            bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
+            Response.OutputStream.Write(ms.GetBuffer(), 0, (int)ms.Length);
+        }
+        /*Expected Results:
+        Only the world would translate. Clipping window would not move.
+        Items draw will be the only thing moving in clipping window.
+
+        Actual Results:
+        numbers before X are translated properly
+        without the clipping window moving.
+        Numbers after X result in clipping window moving.*/
+    }
+</script>
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head runat="server">
+    <title>Untitled Page</title>
+</head>
+<body>
+    <form id="form1" runat="server">
+    <div>
+    
+    </div>
+    </form>
+</body>
+</html>


More information about the mono-bugs mailing list