You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I call the following with BLOB_IS_NULL('abc', NULL, CURRENT_TIMESTAMP) the blob in the udf will get corrupted.
This only happens on a 64 bit system as I've tested it on a 32bit system and it works as I would expect.
If I rearrange the parameters as BLOB_IS_NULL('abc', CURRENT_TIMESTAMP, NULL) things seem to be ok.
If I try to cast the timestamp explicitly BLOB_IS_NULL('abc', NULL, CAST(CURRENT_TIMESTAMP AS CHAR(30))) the blob still gets corrupted.
If I just pass a regular string as parameter 3 everything is fine also. BLOB_IS_NULL('abc', NULL, 'abc')
DECLARE EXTERNAL FUNCTION BLOB_IS_NULL
CSTRING(32767),
BLOB null,
CSTRING(32767) NULL
RETURNS INTEGER BY VALUE
ENTRY_POINT 'blobisnull' MODULE_NAME 'mptfbudf';
Bug happened only for NULL BLOBS. This was due to incorrect space allocation for them on UDF parameters' stack. On 64-bit builds it was more destructive cause blob_handle could be overwritten by next parameter (not a case for 32-bit builds due to smaller pointer size).
Submitted by: James Linse (jlinse)
If I call the following with BLOB_IS_NULL('abc', NULL, CURRENT_TIMESTAMP) the blob in the udf will get corrupted.
This only happens on a 64 bit system as I've tested it on a 32bit system and it works as I would expect.
If I rearrange the parameters as BLOB_IS_NULL('abc', CURRENT_TIMESTAMP, NULL) things seem to be ok.
If I try to cast the timestamp explicitly BLOB_IS_NULL('abc', NULL, CAST(CURRENT_TIMESTAMP AS CHAR(30))) the blob still gets corrupted.
If I just pass a regular string as parameter 3 everything is fine also. BLOB_IS_NULL('abc', NULL, 'abc')
DECLARE EXTERNAL FUNCTION BLOB_IS_NULL
CSTRING(32767),
BLOB null,
CSTRING(32767) NULL
RETURNS INTEGER BY VALUE
ENTRY_POINT 'blobisnull' MODULE_NAME 'mptfbudf';
__int32 blobisnull(char* name, blobcallback* blob_in, char* data)
{
if(blob_in && blob_in->blob_handle && (blob_in->blob_total_length > 0)) {
if(blob_in->blob_total_length > 0) {
return 0; // Blob is not null
}
} else {
return 1;
}
}
Commits: aadc4e6 bc42dd3
The text was updated successfully, but these errors were encountered: