[Mono-bugs] [Bug 434620] New: Structure Corruption

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Oct 12 18:53:20 EDT 2008


           Summary: Structure Corruption
           Product: Mono: Runtime
           Version: 2.0
          Platform: x86-64
               URL: http://sourceforge.net/projects/oogl/
        OS/Version: Ubuntu
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: jmichels at bluefintrading.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User

While using a copy construction in the following code, the resultant structure
data members are corrupted.

// From OOGL Files.cs starting at line 129
// Console.WriteLine(...) added for clarity
for(int i = 0; i < numVertices; i++)

    Vertex v = this.vertices[i];
    this.vertices[i] = new Vertex(r, v, vertexSubVersion);
    Console.WriteLine(this.vertices[i] + "\n");

produces the following sample output.

Vertex flags=0,vertex=(2.794012, 0.899902,
Vertex flags=192,vertex=(0, 2.794012,

The copy constructor code is as follows. The first 4 lines are straight 1:1
member variable copies. Yet, they are modified / corrupted in the returned
structure. It appears the byte alignment is off by 4 bytes during the copy.

public Vertex(BinaryReader r, Vertex v, int subVersion)


    flags = v.flags;

    vertex = v.vertex;

    boneId0 = v.boneId0;

    referenceCount = v.referenceCount;

    boneId1 = r.ReadSByte();

    boneId2 = r.ReadSByte();

    boneId3 = r.ReadSByte();

    weight0 = r.ReadByte() / 255.0f;

    weight1 = r.ReadByte() / 255.0f;

    weight2 = r.ReadByte() / 255.0f;

    if (subVersion == 1) return;

    r.ReadUInt32(); // extra data subversion 2+


Code to reproduce the bug can be found at the following link

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list