Actions
Bug #6310
closedttcn3-pcu-test: TITAN error "Buffer too large for requested CS! encode_trailing_padding_spb (RLCMAC_EncDec.cc:456)"
Start date:
12/15/2023
Due date:
% Done:
100%
Spec Reference:
Description
I am getting this error when running ttcn3-pcu-test using TITAN v10.0.0:
MTC@LEGION: Rx DL block USF 0 vs exp USF 0 Buffer too large for requested CS! encode_trailing_padding_spb (RLCMAC_EncDec.cc:456) Error: Unexpected end of MTC connection from 192.168.1.231 [192.168.1.231]. MC@LEGION: The control connection to MTC is lost. Destroying all PTC connections. MC@LEGION: MTC terminated. ttcn3_start: error: the MTC terminated unexpectedly exit MC@LEGION: Shutting down session. MC@LEGION: Shutdown complete. Dynamic test case error: Sending data on the control connection to MC failed.Dynamic test case error: Control connection was closed unexpectedly by MC. Dynamic test case error: Control connection was closed unexpectedly by MC.Dynamic test case error: Control connection was closed unexpectedly by MC.Dynamic test case error: Control connection was closed unexpectedly by MC.
As a result, the testsuite aborts early and does not execute pending tests.
I can reliably reproduce this by running PCU_Tests.TC_ul_data_toolong_fills_padding
.
Updated by fixeria 4 months ago
The PCU_Tests
binary is actually crashing:
fixeria@LEGION:~$ coredumpctl list -r TIME PID UID GID SIG COREFILE EXE SIZE Fri 2023-12-15 16:08:49 +07 2372189 1000 1001 SIGSEGV present /home/fixeria/projects/osmocom/osmo-ttcn3-hacks/pcu/PCU_Tests 1.0M Fri 2023-12-15 15:42:22 +07 2368005 1000 1001 SIGSEGV present /home/fixeria/projects/osmocom/osmo-ttcn3-hacks/pcu/PCU_Tests 1.0M
Updated by fixeria 4 months ago
- Status changed from New to Feedback
- Assignee set to pespin
This patch fixes the problem for me:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35373 library/RLCMAC_EncDec: fix segfault in encode_trailing_padding_spb() [NEW]
but I am not sure if this is the right way to fix it, assigning to the author of the related code.
447 /* Append padding bytes and spare bits at the end of ttcn_buffer, based on requested CS */
448 static void encode_trailing_padding_spb(TTCN_Buffer& ttcn_buffer, CodingScheme cs)
449 {
450 uint8_t buf[256]; /* enough to fit any RLCMAC buffer*/
451 uint32_t blk_len = RLCMAC__Templates::f__rlcmac__cs__mcs2block__len(cs);
452 uint32_t blk_len_no_spb = RLCMAC__Templates::f__rlcmac__cs__mcs2block__len__no__spare__bits(cs);
453 uint32_t data_len = ttcn_buffer.get_len();
454
455 if (data_len > blk_len_no_spb) {
456 fprintf(stderr, "Buffer too large for requested CS! %s (%s:%u)\n", __func__, __FILE__, __LINE__);
457 // TODO: throw exception?
458 }
459
460 for (int i = 0; i < blk_len_no_spb - data_len; i++)
461 buf[i] = 0x2b; /* Padding bits if needed */
462 for (int i = blk_len_no_spb - data_len; i < blk_len - data_len; i++)
463 buf[i] = 0x00; /* Spare bits if needed */
464
465 const OCTETSTRING& pad_octstr = OCTETSTRING(blk_len - data_len, buf);
466 ttcn_buffer.put_string(pad_octstr);
467 }
Actions