From e0d4ccb4cb955cbf3b06caadca69727680773f26 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Mon, 24 Sep 2018 18:32:07 -0400 Subject: [PATCH] Fix Oracle buffer allocation issue. Hopefully, at least. Closes #316. --- Changes | 3 +++ lib/App/Sqitch/Engine/oracle.pm | 2 +- t/oracle.t | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 45a3f0035..df5dd2224 100644 --- a/Changes +++ b/Changes @@ -30,6 +30,9 @@ Revision history for Perl extension App::Sqitch violation. Thanks to Eric Bréchemier for the suggestion (#344). - Moved the project to its own GitHub organization: https://github.com/sqitchers. + - Fixed likely cause of Oracle buffer allocation bug when selecting + timestamp strings. Thanks to @johannwilfling for the bug report and to + @nmaqsudov for the analysis and solution (#316). 0.9997 2018-03-15T21:13:52Z - Fixed the Firebird engine to properly detect multiple instances of a diff --git a/lib/App/Sqitch/Engine/oracle.pm b/lib/App/Sqitch/Engine/oracle.pm index 0303e70b9..5577eab9f 100644 --- a/lib/App/Sqitch/Engine/oracle.pm +++ b/lib/App/Sqitch/Engine/oracle.pm @@ -136,7 +136,7 @@ sub _log_conflicts_param { } sub _ts2char_format { - q{CAST(to_char(%1$s AT TIME ZONE 'UTC', '"year":YYYY:"month":MM:"day":DD') || to_char(%1$s AT TIME ZONE 'UTC', ':"hour":HH24:"minute":MI:"second":SS:"time_zone":"UTC"') AS VARCHAR2(92 char))} + q{CAST(to_char(%1$s AT TIME ZONE 'UTC', '"year":YYYY:"month":MM:"day":DD') AS VARCHAR2(100 byte)) || CAST(to_char(%1$s AT TIME ZONE 'UTC', ':"hour":HH24:"minute":MI:"second":SS:"time_zone":"UTC"') AS VARCHAR2(168 byte))} } sub _ts_default { 'current_timestamp' } diff --git a/t/oracle.t b/t/oracle.t index 3f2a6b39c..ba49ad3e3 100644 --- a/t/oracle.t +++ b/t/oracle.t @@ -428,7 +428,7 @@ $mock_ora->unmock_all; # Test DateTime formatting stuff. ok my $ts2char = $CLASS->can('_ts2char_format'), "$CLASS->can('_ts2char_format')"; is sprintf($ts2char->(), 'foo'), - q{CAST(to_char(foo AT TIME ZONE 'UTC', '"year":YYYY:"month":MM:"day":DD') || to_char(foo AT TIME ZONE 'UTC', ':"hour":HH24:"minute":MI:"second":SS:"time_zone":"UTC"') AS VARCHAR2(92 char))}, + q{CAST(to_char(foo AT TIME ZONE 'UTC', '"year":YYYY:"month":MM:"day":DD') AS VARCHAR2(100 byte)) || CAST(to_char(foo AT TIME ZONE 'UTC', ':"hour":HH24:"minute":MI:"second":SS:"time_zone":"UTC"') AS VARCHAR2(168 byte))}, '_ts2char_format should work'; ok my $dtfunc = $CLASS->can('_dt'), "$CLASS->can('_dt')";