Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ccccff
  struct A{
	unsigned long i;
};

union AlignedUnion{
	unsigned char B[sizeof(A)];

private:
	unsigned long _align_;
}algn;

int main()
{
	A *a = new(&algn.B[0]) A;
	unsigned long val = 0xaabbccdd;
	a->i = val;
	return (0);
}

  

   Risk Assessment

Accessing a misaligned object may cause the program to terminate abnormally on several systems.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

MEM45-CPP

low

probable

1

P2

L3

 

          Related Vulnerabilities 

           Search for vulnerabilities resulting from the violation of this rule on the CERT website.

...