Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some (wrong ?) parameters of ENCRYPT() leads FB to crash [CORE6185] #6430

Closed
firebird-automations opened this issue Nov 11, 2019 · 5 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

Following examples lead FB to crash:
1) select encrypt( 'fooriobar' using CHACHA20 key q'{1110FB89-AD32-4E}' iv q'{114E811E}' counter cast(null as bigint) ) from rdb$database;
2) script:

set list on;
set blob all;
set bail on;

shell del C:\\temp\\c5970\.fdb 2\>nul;
create database 'localhost:C:\\temp\\c5970\.fdb';
show version;

create or alter procedure sp\_block\_test\(a\_alg varchar\(30\)\) as begin end;
commit;

recreate table test\( crypto\_alg varchar\(30\), source\_text blob, crypto\_key varchar\(128\), crypto\_iv varchar\(16\) \);
commit;

insert into test\( crypto\_alg, source\_text, crypto\_key, crypto\_iv\) values\( 'AES',      lpad\('', 65535, gen\_uuid\(\)\), '0101010101010101', lpad\('',16, uuid\_to\_char\( gen\_uuid\(\) \)\)  \);
commit;

set term ^;
create or alter procedure sp\_block\_test\(a\_alg varchar\(30\)\) as
    declare v\_encrypted blob;
    declare v\_encrypt\_sttm blob;
begin
    for
        select
             t\.source\_text
            ,t\.crypto\_alg
            ,t\.crypto\_key
            ,t\.crypto\_iv
        from test t
        where upper\( t\.crypto\_alg \) = upper\( :a\_alg \)
        as cursor c
    do begin
        v\_encrypt\_sttm = 'select encrypt\( q''\{' \|\| c\.source\_text \|\| '\}'' using ' \|\| c\.crypto\_alg \|\| ' mode ofb key q''\{' \|\| c\.crypto\_key \|\| '\}'' iv q''\{' \|\| c\.crypto\_iv \|\| '\}'' \) from rdb$database';
        execute statement v\_encrypt\_sttm into v\_encrypted;
    end
end
^
set term ;^
commit;

set echo on;
execute procedure sp\_block\_test\('aes'\);

=======

Dumps and stack trace have been sent to Alex et al.

Commits: 766cfa1

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0.5 [ 10885 ]

Fix Version: 4.0 Beta 2 [ 10888 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 3.0.5 [ 10885 ] =>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants