]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 701350: Oracle crashes if the 'maxattachmentsize' parameter is set to a too small...
authorFrédéric Buclin <LpSolit@gmail.com>
Mon, 5 Dec 2011 16:15:26 +0000 (17:15 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Mon, 5 Dec 2011 16:15:26 +0000 (17:15 +0100)
r/a=mkanat

Bugzilla/DB/Oracle.pm

index df815c9a82567fb1c5762ac43364ba67d1adec0f..df061dc24c977b4d1f2dde635e8055647bd1b3a9 100644 (file)
@@ -40,6 +40,8 @@ use base qw(Bugzilla::DB);
 
 use DBD::Oracle;
 use DBD::Oracle qw(:ora_types);
+use List::Util qw(max);
+
 use Bugzilla::Constants;
 use Bugzilla::Error;
 use Bugzilla::Util;
@@ -50,6 +52,8 @@ use Bugzilla::Util;
 use constant EMPTY_STRING  => '__BZ_EMPTY_STR__';
 use constant ISOLATION_LEVEL => 'READ COMMITTED';
 use constant BLOB_TYPE => { ora_type => ORA_BLOB };
+# The max size allowed for LOB fields, in kilobytes.
+use constant MIN_LONG_READ_LEN => 32 * 1024;
 use constant FULLTEXT_OR => ' OR ';
 
 sub new {
@@ -68,8 +72,8 @@ sub new {
     my $dsn = "dbi:Oracle:host=$host;sid=$dbname";
     $dsn .= ";port=$port" if $port;
     my $attrs = { FetchHashKeyName => 'NAME_lc',  
-                  LongReadLen => ( Bugzilla->params->{'maxattachmentsize'}
-                                     || 1000 ) * 1024, 
+                  LongReadLen => max(Bugzilla->params->{'maxattachmentsize'},
+                                     MIN_LONG_READ_LEN) * 1024,
                 };
     my $self = $class->db_new({ dsn => $dsn, user => $user, 
                                 pass => $pass, attrs => $attrs });