UDF Plugin will crash Firebird at linux
----------------------------------------
Key: CORE-6443
URL: http://tracker.firebirdsql.org/browse/CORE-6443
Project: Firebird Core
Issue Type: Bug
Affects Versions: 3.0.7
Environment: Linux debian 10
Reporter: Sorien
Windows works fine
DECLARE EXTERNAL FUNCTION FILE_STORE
BLOB,
VARCHAR(300) BY DESCRIPTOR
RETURNS
INTEGER BY VALUE
ENTRY_POINT 'file_store' MODULE_NAME 'storage';
udf part
bool isnull(const paramdsc* v)
{
return !v || !v->dsc_address || (v->dsc_flags & DSC_null);
}
extern "C" FB_DLL_EXPORT int file_store(blobcallback* sourceBlob, const
paramdsc* sFileName)
{
if (isnull(sFileName)) { // <- will crash here
return -1;
}
ISC_UCHAR* text = 0;
int len = get_any_string_type(sFileName, text);
if (!sourceBlob->blob_handle) {
return -1;
}
char* name = null_terminated_string(text, len);
makePath(splitFilename(name));
FILE *fp;
ISC_UCHAR *pbuffer;
ISC_USHORT length, actual_length;
fp = fopen(name, "w");
if (fp == NULL) {
free(name);
return errno;
}
length = sourceBlob->blob_max_segment + 1L;
pbuffer = (ISC_UCHAR *)malloc(length);
while ((*sourceBlob->blob_get_segment) (sourceBlob->blob_handle,
pbuffer, length, &actual_length)) {
if (fwrite(pbuffer, actual_length, 1, fp) != 1) {
return errno;
}
}
free(name);
fclose(fp);
free(pbuffer);
return 0;
}
it srashes also when i try to replace VARCHAR(300) BY DESCRIPTOR with CString
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel