generated from EVerest/everest-template
-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
ISO Version
ISO15118-20
Describe the bug
Compile the following harness.
#include <cbv2g/exi_v2gtp.h>
#include <iso15118/message/schedule_exchange.hpp>
#include <iso15118/message/variant.hpp>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <iso15118/io/stream_view.hpp>
uint8_t* readAllStdin(size_t& length) {
std::vector<uint8_t> buffer;
char temp;
// Read all input data from stdin
while (std::cin.get(temp)) {
buffer.push_back(static_cast<uint8_t>(temp));
}
// Allocate memory for the buffer and copy the data
length = buffer.size();
uint8_t* data = new uint8_t[length];
std::copy(buffer.begin(), buffer.end(), data);
return data;
}
int main()
{
size_t len;
uint8_t* data = readAllStdin(len);
const iso15118::io::StreamInputView stream_view{data, len};
iso15118::message_20::Variant variant(iso15118::io::v2gtp::PayloadType::Part20AC, stream_view);
}
g++ main.cpp -I ./libiso15118/build/_deps/libcbv2g-src/include/ -I libiso15118/include/ libiso15118/build/src/iso15118/libiso15118.a ./libiso15118//build/_deps/libcbv2g-build/lib/cbv2g/libcbv2g_tp.a libiso15118/build/_deps/libcbv2g-build/lib/cbv2g/libcbv2g_iso20.a libiso15118/build/_deps/libcbv2g-build/lib/cbv2g/libcbv2g_exi_codec.a -fprofile-arcs -ftest-coverage -o ac
Pass the following base64-encoded EXI document over stdin and run the harness with valgrind.
bperry@bperry-Precision-T5610:~/tmp$ echo -n AQgAgADiA+gEAGQEBgQEjcVBAgEIAAI= | base64 --decode | valgrind ./ac
==1582592== Memcheck, a memory error detector
==1582592== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==1582592== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==1582592== Command: ./ac
==1582592==
ac: /home/bperry/tmp/libiso15118/src/iso15118/message/ac_charge_loop.cpp:139: void iso15118::message_20::convert(const InType&, OutType&) [with InType = iso20_ac_AC_ChargeLoopReqType; OutType = AC_ChargeLoopRequest]: Assertion `false' failed.
==1582592==
==1582592== Process terminating with default action of signal 6 (SIGABRT)
==1582592== at 0x4CA5B1C: __pthread_kill_implementation (pthread_kill.c:44)
==1582592== by 0x4CA5B1C: __pthread_kill_internal (pthread_kill.c:78)
==1582592== by 0x4CA5B1C: pthread_kill@@GLIBC_2.34 (pthread_kill.c:89)
==1582592== by 0x4C4C26D: raise (raise.c:26)
==1582592== by 0x4C2F8FE: abort (abort.c:79)
==1582592== by 0x4C2F81A: __assert_fail_base.cold (assert.c:94)
==1582592== by 0x4C42506: __assert_fail (assert.c:103)
==1582592== by 0x16456A: void iso15118::message_20::convert<iso20_ac_AC_ChargeLoopReqType, iso15118::message_20::AC_ChargeLoopRequest>(iso20_ac_AC_ChargeLoopReqType const&, iso15118::message_20::AC_ChargeLoopRequest&) (ac_charge_loop.cpp:139)
==1582592== by 0x164690: insert_type<iso15118::message_20::AC_ChargeLoopRequest, iso20_ac_AC_ChargeLoopReqType> (variant_access.hpp:30)
==1582592== by 0x164690: void iso15118::message_20::insert_type<iso20_ac_AC_ChargeLoopReqType>(iso15118::message_20::VariantAccess&, iso20_ac_AC_ChargeLoopReqType const&) (ac_charge_loop.cpp:144)
==1582592== by 0x11FD0A: iso15118::message_20::handle_ac(iso15118::message_20::VariantAccess&) (variant.cpp:108)
==1582592== by 0x12617F: iso15118::message_20::Variant::Variant(iso15118::io::v2gtp::PayloadType, iso15118::io::StreamInputView const&) (variant.cpp:127)
==1582592== by 0x11E0C7: main (in /home/bperry/tmp/ac)
==1582592==
==1582592== HEAP SUMMARY:
==1582592== in use at exit: 78,047 bytes in 4 blocks
==1582592== total heap usage: 16 allocs, 12 frees, 80,522 bytes allocated
==1582592==
==1582592== LEAK SUMMARY:
==1582592== definitely lost: 0 bytes in 0 blocks
==1582592== indirectly lost: 0 bytes in 0 blocks
==1582592== possibly lost: 0 bytes in 0 blocks
==1582592== still reachable: 78,047 bytes in 4 blocks
==1582592== suppressed: 0 bytes in 0 blocks
==1582592== Rerun with --leak-check=full to see details of leaked memory
==1582592==
==1582592== For lists of detected and suppressed errors, rerun with: -s
==1582592== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Aborted
bperry@bperry-Precision-T5610:~/tmp$
To Reproduce
Details above
Anything else?
Please let me know if I should file this under the cbexigen repo instead.
To Reproduce
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working