diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index fd44f9b..8627b60 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -4,9 +4,6 @@ on: push: branches: - master - pull_request: - branches: - - master jobs: test-packio: diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml new file mode 100644 index 0000000..bfab712 --- /dev/null +++ b/.github/workflows/dev-ci.yml @@ -0,0 +1,25 @@ +--- +name: Bump Packio version +on: + pull_request: + branches: + - master + +jobs: + test-packio: + name: Build and Test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-13, macos-14] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build C++ project and run C++ tests + run: | + mkdir build && cd build + cmake -DPACKIO_BUILD_TESTS=ON .. && cmake --build . + ctest . + cd .. \ No newline at end of file diff --git a/modules/core/include/packio/core/serializable.h b/modules/core/include/packio/core/serializable.h index c93b9ee..3886b1a 100644 --- a/modules/core/include/packio/core/serializable.h +++ b/modules/core/include/packio/core/serializable.h @@ -165,6 +165,10 @@ namespace packio struct DeserializeHelper { static U deserialize(std::istream& stream, const std::array& signature) { + if(stream.bad()){ + throw std::runtime_error("Attempt to deserialize with a bad stream"); + } + // 1) Check signature std::array expectedSig = serializeSignature(); if (!std::equal(signature.begin(), signature.end(), expectedSig.begin())) { @@ -295,6 +299,10 @@ namespace packio template inline void serialize(const T &serializable, std::ostream &stream) { + if(stream.bad()){ + throw std::runtime_error("Attempt to serialize with a bad stream"); + } + // 1) Write out "signature" (unique ID for type T) auto signature = serializeSignature(); writeAll(stream, signature.data(), signature.size(),