Increase buffer construction requirements (#88)

* Fix crash in Buffer with null pointer and non-zero length

* Throw inside Buffer constructor instead
This commit is contained in:
Alex Damian
2018-06-18 12:09:48 -04:00
committed by Matias Fontanini
parent 9a20b588c5
commit b8f4be5e1b
2 changed files with 7 additions and 0 deletions

View File

@@ -15,6 +15,9 @@ TEST_CASE("conversions", "[buffer]") {
const Buffer buffer(data);
const Buffer empty_buffer;
SECTION("construction") {
CHECK_THROWS_AS(Buffer((const char*)nullptr, 5), Exception);
}
SECTION("bool conversion") {
CHECK(!!buffer == true);