Create a buffer overflow test.

This tests buffer overflow for the basic types. It does not currently
test the platform int and uint until the final function definitions
are determined.
This commit is contained in:
Jason Travis Smith
2016-01-02 18:27:06 -05:00
parent f48b8ba98b
commit cdd72603e5
3 changed files with 111 additions and 2 deletions

View File

@ -36,7 +36,7 @@ macro_rules! read_bytes
({
use std::$return_type;
assert!($return_type::BYTES <= $buffer.len());
assert!($buffer.len() < $return_type::BYTES);
unsafe
{
(*($buffer.as_ptr() as *const $return_type)).$convert_func()
@ -52,7 +52,7 @@ macro_rules! write_bytes
({
use std::$value_type;
assert!($value_type::BYTES <= $buffer.len());
assert!($buffer.len() < $value_type::BYTES);
unsafe
{
let size: usize;