From: Andrei K. <a_k...@ya...> - 2002-04-28 20:03:08
|
hi, did you post it into sourceforge.net/projects/firebird bug base? ""Konstantin Kuznetsov"" <klk...@ns...> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:aadijn$17c$1...@ne...... > Hi All ! > I think, what I found bug > > I write some udfs, working with WIN1251 chars, > one of them > DECLARE EXTERNAL FUNCTION A_CONCAT_FIELDS > CSTRING(256) CHARACTER SET WIN1251, > CSTRING(256) CHARACTER SET WIN1251, > CSTRING(256) CHARACTER SET WIN1251, > CSTRING(256) CHARACTER SET WIN1251, > CSTRING(256) CHARACTER SET WIN1251, > CSTRING(256) CHARACTER SET WIN1251, > CSTRING(256) CHARACTER SET WIN1251, > CSTRING(256) CHARACTER SET WIN1251, > CSTRING(256) CHARACTER SET WIN1251, > CSTRING(256) CHARACTER SET WIN1251 > RETURNS CSTRING(512) CHARACTER SET WIN1251 FREE_IT > ENTRY_POINT 'A_Concat_Fields' MODULE_NAME 'a_sun.DLL'; > > isql database -i test.sql > > So SQL is > SELECT > A_Concat_Fields("", > "max: ", a_FormatFloat(MAX(ORG_USTFOND)), " ?.?." || a_newst(), > "", > "", "", "", > "", "") || > " " INFO > FROM > Get_ChildsKom; > > So I pass "" formaly ('\0') to udf. > My server crashed. > > I try #gdb isql core > and found > Reading symbols from /usr/interbase/UDF/a_sun.DLL...done. > Reading symbols from /usr/lib/libgds.so.0...done. > Reading symbols from /usr/lib/libib_util.so...done. > #0 0xdfdd8c3b in pad_spaces (tdbb=0x80477ac, charset=2, ptr=0xdfecd24d " ", > len=1) > at intl.c:2576 > list give me some strings in intl.c > > 2571 /* Single-octet character sets are optimized here */ > 2572 if (obj->charset_space_length == 1) > 2573 { > 2574 end = &ptr [len]; > 2575 while (ptr < end) > 2576 *ptr++ = *obj->charset_space_character; > 2577 } > 2578 else > 2579 { > 2580 end = &ptr [len]; > So exception in 2576 > *ptr++ = *obj->charset_space_character; > I think it > *(ptr++) = *obj->charset_space_character; > So code try to access out of my one byte string. > > If i pass two byte like > SELECT > A_Concat_Fields(" ", > "max: ", a_FormatFloat(MAX(ORG_USTFOND)), " ?.?." || a_newst(), > " ", > " ", " ", " ", > " ", " ") || > " " INFO > > FROM > Get_ChildsKom; > > All is ok > > Who fix it? > I think we should check if lenght(ptr)> 1, and do ptr++. > > > -- > Konstantin Kuznetsov, phD > http://www.FireBirdSQL.org > > > > > > > _______________________________________________ > Firebird-devel mailing list > Fir...@li... > https://lists.sourceforge.net/lists/listinfo/firebird-devel > |