Repository navigation
Done
Labels
Description
Describe the bug
When the expectation text is long, the framework fails to process it correctly and there is a buffer overflow of 4000 chars that is causing the test to finish with an error instead of reporting a failure.
Provide version info
Information about utPLSQL and Database version,
utPLSQL v.3.2.3.4508
DB: 19.20
OS: x86_64/Linux 2.4.xx
To Reproduce
create or replace package test_package1 is
--%suite
--%test
procedure sp_test;
end;
/create or replace package body test_package1 is
procedure sp_test is
begin
ut.expect(1, 'message').to_equal(2); /*3999 chars of comment *****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
end;
end;
/begin
ut.run('test_package1');
end;This causes a test finishing with framework exception:
test_package1
sp_test [,005 sec] (FAILED - 1)
Failures:
1) sp_test
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "UT3.UT_EXPECTATION_PROCESSOR", line 194
ORA-06512: at "UT3.UT_EXPECTATION_RESULT", line 29
ORA-06512: at "UT3.UT_EXPECTATION_BASE", line 30
ORA-06512: at "UT3.UT_EXPECTATION", line 118
ORA-06512: at "PMUSER.TEST_PACKAGE1", line 4
ORA-06512: at "UT3.UT_EXPECTATION_PROCESSOR", line 194
ORA-06512: at "UT3.UT_EXPECTATION_RESULT", line 29
ORA-06512: at "UT3.UT_EXPECTATION_BASE", line 30
ORA-06512: at "UT3.UT_EXPECTATION", line 118
ORA-06512: at "PMUSER.TEST_PACKAGE1", line 4
ORA-06512: at line 7
Finished in ,0072 seconds
1 tests, 0 failed, 1 errored, 0 disabled, 0 warning(s)
Expected behavior
The framework should handle correctly long lines in and around expectations.
It could for example show first 500 chars of the failing line to prevent the overflow.
test_package1
sp_test [,005 sec] (FAILED - 1)
Failures:
1) sp_test
"message"
Actual: 1 (number) was expected to equal: 2 (number)
at "PMUSER.TEST_PACKAGE1.SP_TEST", line 4 ut.expect(1, 'message').to_equal(2); /*3999 chars of comment *******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
Finished in ,007418 seconds
1 tests, 1 failed, 0 errored, 0 disabled, 0 warning(s)
Activity
jgebal commentedon Nov 19, 2026
This issue is related to #1396 and to problems that are getting fixed in in PR #1394
vasipallyn commentedon Nov 25, 2026
Hi @jgebal, I'd like to work on this one.
The overflow comes from
ut_expectation_processor.who_called_expectation: the caller line, the source line returned byut_metadata.get_source_definition_lineand the remaining call stack are concatenated intol_result varchar2(4000), so a source line close to 4000 bytes overflows it.Proposed fix:
at "...", line Nto the first 500 characters (with a...marker when cut), as suggested in the issue.I'd keep this independent of #1394/#1396 (how a source line split across rows in
all_sourceis read and numbered), so the two changes don't overlap.Tests: a case in
test_expectation_processorthat creates a package with a line over 4000 bytes next to the expectation and checks that the test fails (not errors) with a truncated source line, plus a case for a long call stack.Does 500 characters work for you, and is it OK to keep this separate from #1394?
jgebal commentedon Nov 26, 2026
Hi @vasipallyn
Thank you for your interest in contributing to the codebase.
Feel free to give it a go.
The fix should be done outside of #1394 and there should be no conflicts. This is why I created 2 separate issues to track those bugs.
Truncate long source lines in expectation caller info