| Bug #67871 | UDF argument crosses over between rows | ||
|---|---|---|---|
| Submitted: | 11 Dec 2012 1:30 | Modified: | 13 Dec 2012 21:16 |
| Reporter: | Tom Pledger | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: User-defined functions ( UDF ) | Severity: | S3 (Non-critical) |
| Version: | 5.1.60 and 5.5.24-log | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | argument, crosstalk, udf | ||
[11 Dec 2012 1:30]
Tom Pledger
[11 Dec 2012 21:13]
Tom Pledger
[Edit 12/Dec/2012 NZDT] I've now seen how to attach files, so will upload the 3 I was talking about, instead of standing by to email them if asked.
[11 Dec 2012 21:27]
Tom Pledger
Please disregard the part of C-function-tests.sql before 'create database datamine_arg2c;'.
[13 Dec 2012 19:12]
Sveta Smirnova
Thank you for the report.
This is not a bug. You have to check length of third argument before assigning it to repl.
I added following check:
else if (*repl)
{
fprintf(stderr, "Repl, i: %d, repl: %s, len: %d\n", i, repl, args->lengths[2]);
/* s[i] is to be replaced */
*resultp++ = *repl;
}
Then I saw in the error log file:
Repl, i: 0, repl: -^GINCLUDE, len: 0
i: 1, s[i]: s
Repl, i: 2, repl: -^GINCLUDE, len: 0
Repl, i: 3, repl: -^GINCLUDE, len: 0
Repl, i: 4, repl: -^GINCLUDE, len: 0
i: 5, s[i]: s
i: 6, s[i]: s
Repl, i: 7, repl: -^GINCLUDE, len: 0
Repl, i: 8, repl: -^GINCLUDE, len: 0
Repl, i: 9, repl: -^GINCLUDE, len: 0
Repl, i: 10, repl: -^GINCLUDE, len: 0
i: 11, s[i]: s
Repl, i: 12, repl: -^GINCLUDE, len: 0
Repl, i: 13, repl: -^GINCLUDE, len: 0
This clearly demonstrates source of the problem.
[13 Dec 2012 21:16]
Tom Pledger
Thanks. That's good news - it's easy to fix. Apologies for troubling you with my null-terminated string habit!
