@@ -1259,7 +1259,7 @@ void put_blob( burp_fld* field, ISC_QUAD& blob_id)
1259
1259
return;
1260
1260
}
1261
1261
1262
- UCHAR blob_info[32 ];
1262
+ UCHAR blob_info[BUFFER_TINY ];
1263
1263
if (!blob.getInfo(sizeof(blob_items), blob_items, sizeof(blob_info), blob_info))
1264
1264
{
1265
1265
BURP_error_redirect(&status_vector, 20);
@@ -1388,32 +1388,33 @@ bool put_blr_blob( att_type attribute, ISC_QUAD& blob_id)
1388
1388
// msg 24 isc_open_blob failed
1389
1389
}
1390
1390
1391
- UCHAR blob_info[32 ];
1391
+ UCHAR blob_info[BUFFER_TINY ];
1392
1392
if (!blob.getInfo(sizeof(blr_items), blr_items, sizeof(blob_info), blob_info))
1393
1393
{
1394
1394
BURP_error_redirect(&status_vector, 20);
1395
1395
// msg 20 isc_blob_info failed
1396
1396
}
1397
1397
1398
- ULONG length = 0;
1398
+ FB_UINT64 length = 0;
1399
1399
USHORT max_segment = 0;
1400
1400
const UCHAR* p = blob_info;
1401
1401
UCHAR item;
1402
1402
1403
1403
while ((item = *p++) != isc_info_end)
1404
1404
{
1405
- const USHORT l = isc_vax_integer((const char*) p, 2);
1405
+ const auto l = gds__vax_integer( p, 2);
1406
1406
p += 2;
1407
- const ULONG n = isc_vax_integer((const char*) p, l);
1407
+ const auto n = isc_portable_integer( p, l);
1408
1408
p += l;
1409
+
1409
1410
switch (item)
1410
1411
{
1411
1412
case isc_info_blob_max_segment:
1412
- max_segment = n;
1413
+ max_segment = (USHORT) n;
1413
1414
break;
1414
1415
1415
1416
case isc_info_blob_total_length:
1416
- length = n;
1417
+ length = (FB_UINT64) n;
1417
1418
break;
1418
1419
1419
1420
default:
@@ -1426,7 +1427,7 @@ bool put_blr_blob( att_type attribute, ISC_QUAD& blob_id)
1426
1427
}
1427
1428
}
1428
1429
1429
- if (!length)
1430
+ if (!length || length > MAX_ULONG )
1430
1431
{
1431
1432
if (!blob.close())
1432
1433
BURP_error_redirect(&status_vector, 23);
@@ -2136,37 +2137,38 @@ bool put_source_blob(att_type attribute, att_type old_attribute, ISC_QUAD& blob_
2136
2137
// msg 24 isc_open_blob failed
2137
2138
}
2138
2139
2139
- UCHAR blob_info[48 ];
2140
+ UCHAR blob_info[BUFFER_TINY ];
2140
2141
if (!blob.getInfo(sizeof(source_items), source_items, sizeof(blob_info), blob_info))
2141
2142
{
2142
2143
BURP_error_redirect(&status_vector, 20);
2143
2144
// msg 20 isc_blob_info failed
2144
2145
}
2145
2146
2146
- ULONG length = 0;
2147
+ FB_UINT64 length = 0;
2147
2148
ULONG num_seg = 0;
2148
2149
USHORT max_segment = 0;
2149
2150
const UCHAR* p = blob_info;
2150
2151
UCHAR item;
2151
2152
2152
2153
while ((item = *p++) != isc_info_end)
2153
2154
{
2154
- const USHORT l = gds__vax_integer(p, 2);
2155
+ const auto l = gds__vax_integer(p, 2);
2155
2156
p += 2;
2156
- const ULONG n = gds__vax_integer (p, l);
2157
+ const auto n = isc_portable_integer (p, l);
2157
2158
p += l;
2159
+
2158
2160
switch (item)
2159
2161
{
2160
2162
case isc_info_blob_max_segment:
2161
- max_segment = n;
2163
+ max_segment = (USHORT) n;
2162
2164
break;
2163
2165
2164
2166
case isc_info_blob_total_length:
2165
- length = n;
2167
+ length = (FB_UINT64) n;
2166
2168
break;
2167
2169
2168
2170
case isc_info_blob_num_segments:
2169
- num_seg = n;
2171
+ num_seg = (ULONG) n;
2170
2172
break;
2171
2173
2172
2174
default:
@@ -2181,7 +2183,7 @@ bool put_source_blob(att_type attribute, att_type old_attribute, ISC_QUAD& blob_
2181
2183
}
2182
2184
}
2183
2185
2184
- if (!length)
2186
+ if (!length || length > MAX_ULONG )
2185
2187
{
2186
2188
if (!blob.close())
2187
2189
{
@@ -3881,8 +3883,11 @@ void write_relations()
3881
3883
// RDB$VIEW_BLR must be the first blob field in the backup file.
3882
3884
// RESTORE.EPP makes this assumption in get_relation().
3883
3885
3884
- if (put_blr_blob (att_relation_view_blr, X.RDB$VIEW_BLR))
3886
+ if (!X.RDB$VIEW_BLR.NULL && !BlobWrapper::blobIsNull( X.RDB$VIEW_BLR))
3885
3887
flags |= REL_view;
3888
+
3889
+ put_blr_blob (att_relation_view_blr, X.RDB$VIEW_BLR);
3890
+
3886
3891
if (X.RDB$SYSTEM_FLAG)
3887
3892
put_int32 (att_relation_system_flag, X.RDB$SYSTEM_FLAG);
3888
3893
if (!X.RDB$FLAGS.NULL)
@@ -3941,8 +3946,10 @@ void write_relations()
3941
3946
// RDB$VIEW_BLR must be the first blob field in the backup file.
3942
3947
// RESTORE.EPP makes this assumption in get_relation().
3943
3948
3944
- if (put_blr_blob (att_relation_view_blr, X.RDB$VIEW_BLR))
3949
+ if (!X.RDB$VIEW_BLR.NULL && !BlobWrapper::blobIsNull( X.RDB$VIEW_BLR))
3945
3950
flags |= REL_view;
3951
+
3952
+ put_blr_blob (att_relation_view_blr, X.RDB$VIEW_BLR);
3946
3953
if (X.RDB$SYSTEM_FLAG)
3947
3954
put_int32 (att_relation_system_flag, X.RDB$SYSTEM_FLAG);
3948
3955
if (!X.RDB$FLAGS.NULL)
0 commit comments