Files

2.7 KiB

Task 2 Report

status: DONE_WITH_CONCERNS

Files created/modified

  • CMakeLists.txt
  • include/mag160c/mag160c.h
  • src/core/tcm_frame.hpp
  • src/core/tcm_frame.cpp
  • src/c_api.cpp
  • tests/cpp/test_c_api.cpp
  • tests/cpp/test_tcm_frame.cpp
  • progress.md

Commands run

g++ -std=c++17 -DMAG160C_STATIC -DMAG160C_HAS_LIBUSB=0 -Iinclude -Isrc src\core\error.cpp src\core\context.cpp src\core\tcm_frame.cpp src\c_api.cpp tests\cpp\test_c_api.cpp -o build_task2_c_api_test.exe
.\build_task2_c_api_test.exe
g++ -std=c++17 -DMAG160C_STATIC -DMAG160C_HAS_LIBUSB=0 -Iinclude -Isrc src\core\error.cpp src\core\context.cpp src\core\tcm_frame.cpp src\c_api.cpp tests\cpp\test_tcm_frame.cpp -o build_task2_tcm_frame_test.exe
.\build_task2_tcm_frame_test.exe

Test results

  • Direct MinGW C++17 compile/run verification passed for test_c_api.
  • Direct MinGW C++17 compile/run verification passed for test_tcm_frame.

Concerns

  • CMake/CTest verification remains unavailable because cmake is not installed or not on PATH in this environment.
  • Generated local executables build_task2_c_api_test.exe and build_task2_tcm_frame_test.exe exist from substitute verification.

Self-review notes

  • TCM encode exact vector for rotate +5 is implemented and tested.
  • Header checksum and body checksum use additive uint8_t wrapping.
  • C ABI encode reports required size when output buffer is too small.
  • C ABI decode_header delegates to decode_tcm_frame and returns parsed main/sub/frame/payload size.
  • Public header now includes stddef.h and stdint.h because Task 2 introduced size_t and fixed-width integer types.

Fix report: oversized TCM payload safety

status: DONE

Files modified

  • src/core/tcm_frame.cpp
  • src/c_api.cpp
  • tests/cpp/test_c_api.cpp
  • tests/cpp/test_tcm_frame.cpp

Commands run

g++ -std=c++17 -DMAG160C_STATIC -DMAG160C_HAS_LIBUSB=0 -Iinclude -Isrc src\core\error.cpp src\core\context.cpp src\core\tcm_frame.cpp src\c_api.cpp tests\cpp\test_c_api.cpp -o build_task2_c_api_test.exe
.\build_task2_c_api_test.exe
g++ -std=c++17 -DMAG160C_STATIC -DMAG160C_HAS_LIBUSB=0 -Iinclude -Isrc src\core\error.cpp src\core\context.cpp src\core\tcm_frame.cpp src\c_api.cpp tests\cpp\test_tcm_frame.cpp -o build_task2_tcm_frame_test.exe
.\build_task2_tcm_frame_test.exe

Test results

  • Direct MinGW C++17 compile/run verification passed for test_c_api.
  • Direct MinGW C++17 compile/run verification passed for test_tcm_frame.

Self-review

  • Oversized payloads are rejected before allocation/copy.
  • C ABI oversized payload path returns MAG160C_ERR_INVALID_ARGUMENT, sets out_size to 0, and sets last_error containing "too large".
  • Core encode_tcm_frame oversized payload path is covered by a std::length_error test.