View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000602 | LDMud 3.3 | Efuns | public | 2009-01-17 17:13 | 2009-04-14 12:11 |
| Reporter | wedsall | Assigned To | zesstra | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | 3.3.718 | ||||
| Target Version | 3.3.719 | Fixed in Version | 3.3.719 | ||
| Summary | 0000602: db_conv_string bugging over 27 characters | ||||
| Description | Hello list, I'm about to log this into mantis but wanted to post also. In 3.3.717 I started using the mysql features of ldmud. They've been working well until I upgraded to 3.3.718. This reboot (using 3.3.718 now) I'm getting bugs with db_conv_string returning strange ascii characters. Example: db_conv_string("domains/areas/apollo/floor1/entr_castle") LPC result: " "D Ô Ô I will also attach a screenshot. This seems to happen on any string I use over 27 characters! lpc db_conv_string("testtesttesttesttesttesttesttesttesttest") LPC result: ""DP „µ• testtesttesttesttesttesttesttest" uuga @ dragonfire | ||||
| Tags | No tags attached. | ||||
| Attached Files | pkg-mysql.diff (781 bytes)
Index: pkg-mysql.c
===================================================================
--- pkg-mysql.c (Revision 2502)
+++ pkg-mysql.c (Arbeitskopie)
@@ -377,7 +377,8 @@
char *buff;
s = sp->u.str;
- buff = xalloc(mstrsize(s)*2 +1);
+ buff = xalloc_with_error_handler(mstrsize(s)*2 +1);
+ // top of stack / inter_sp is now one larger than sp!
if ( !buff )
{
errorf("Out of memory (%zu bytes) in db_conv_string().\n",
@@ -387,9 +388,11 @@
}
mysql_escape_string(buff, get_txt(s), strlen(get_txt(s)) );
- xfree(buff);
free_string_svalue(sp);
put_c_string(sp, buff);
+ // the error handler is one above sp on the stack.
+ pop_stack();
+ // sp == inter_sp again.
return sp;
} /* f_db_conv_string() */
| ||||
|
|
Thanks for your report. Gna. I guess, I found the problem. Could you please try the attached patch and confirm if it works? |
|
|
Trying this on my dev side. Before patch: lpc db_conv_string("testytestytestytestytestytestytestytesty") LPC result: "¼¢ø> After patch:> lpc db_conv_string("testytestytestytestytestytestytestytesty") LPC result: "testytestytestytestytestytestytestytesty" Looks good! |
|
|
can confirm bug and solution. fast work, zeestra. |
|
|
BTW: the patch from last night was only the quick (and dirty) solution. In rare circumstances it can result in memory leaks. I updated it to use an error handler. Fixed in r2506. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2009-01-17 17:13 | wedsall | New Issue | |
| 2009-01-17 17:13 | wedsall | File Added: example_uugabug.png | |
| 2009-01-17 17:24 | zesstra | Note Added: 0000923 | |
| 2009-01-17 17:24 | zesstra | File Added: pkg-mysql.diff | |
| 2009-01-17 18:43 | wedsall | Note Added: 0000925 | |
| 2009-01-17 18:46 | peng | Note Added: 0000926 | |
| 2009-01-18 03:06 | zesstra | Assigned To | => zesstra |
| 2009-01-18 03:06 | zesstra | Status | new => assigned |
| 2009-01-18 03:06 | zesstra | Target Version | => 3.3.719 |
| 2009-01-18 06:49 | zesstra | File Deleted: pkg-mysql.diff | |
| 2009-01-18 06:49 | zesstra | File Added: pkg-mysql.diff | |
| 2009-01-18 06:59 | zesstra | Note Added: 0000927 | |
| 2009-01-18 06:59 | zesstra | Status | assigned => resolved |
| 2009-01-18 06:59 | zesstra | Fixed in Version | => 3.3.719 |
| 2009-01-18 06:59 | zesstra | Resolution | open => fixed |
| 2009-04-14 12:11 | zesstra | Project | LDMud => LDMud 3.3 |