mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
56 lines
1.4 KiB
Python
56 lines
1.4 KiB
Python
|
#coding:utf-8
|
||
|
|
||
|
"""
|
||
|
ID: issue-7380
|
||
|
ISSUE: 7380
|
||
|
TITLE: Aliased blob variable with less restrictions makes text blob accept malformed string through BLOB_APPEND
|
||
|
NOTES:
|
||
|
[16.02.2023] pzotov
|
||
|
Confirmed bug on 5.0.0.821, 4.0.3.2873
|
||
|
Checked on 5.0.0.938, 4.0.3.2876 -- all fine.
|
||
|
::: NOTE :::
|
||
|
If script is executed from command line using ISQL then problem looks as described in the ticket.
|
||
|
But if the same script is executed from firebird-qa then FB 5.0.0.821 crashes.
|
||
|
"""
|
||
|
|
||
|
import pytest
|
||
|
from firebird.qa import *
|
||
|
|
||
|
db = db_factory()
|
||
|
|
||
|
test_script = """
|
||
|
set list on;
|
||
|
|
||
|
set term ^;
|
||
|
create table t (b_utf8 blob sub_type text character set utf8)
|
||
|
^
|
||
|
|
||
|
-- Wrong: no "Malformed string" error
|
||
|
execute block
|
||
|
as
|
||
|
declare b blob sub_type text character set utf8;
|
||
|
declare bb blob sub_type binary;
|
||
|
begin
|
||
|
b = blob_append(b, 'a');
|
||
|
bb = b;
|
||
|
-- No error
|
||
|
b = blob_append(bb, x'FF');
|
||
|
-- Malformed blob is saved to table
|
||
|
insert into t (b_utf8) values (:b);
|
||
|
end
|
||
|
^
|
||
|
"""
|
||
|
|
||
|
act = isql_act('db', test_script, substitutions=[('-At block line:.*', '')])
|
||
|
|
||
|
expected_stdout = """
|
||
|
Statement failed, SQLSTATE = 22000
|
||
|
Malformed string
|
||
|
"""
|
||
|
|
||
|
@pytest.mark.version('>=4.0.3')
|
||
|
def test_1(act: Action):
|
||
|
act.expected_stdout = expected_stdout
|
||
|
act.execute(combine_output = True)
|
||
|
assert act.clean_stdout == act.clean_expected_stdout
|