Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upWin32XP. Branch: 0.A Master. SIGSEGV. (0x004352a3 acces violation). Catacharset.cpp::UTF8_getch #8763
Comments
WareXD
changed the title
Win32XP. Branch: 0.A Master. SIGSEGV. (0x004352a3 acces violation). Catacharset::UTF8_getch
Win32XP. Branch: 0.A Master. SIGSEGV. (0x004352a3 acces violation). Catacharset.cpp::UTF8_getch
Aug 31, 2014
This comment has been minimized.
This comment has been minimized.
|
Meanwhile... I'm trying RTFM about to C++ pointers for noob's... Shit shit shit oh my brains. HolyLoL.)) |
KA101
added
Bug
labels
Aug 31, 2014
This comment has been minimized.
This comment has been minimized.
|
Well, it's more info about the crafting crash than we've had in a while, so thanks for the report! :-) |
kevingranade
added
the
validated
label
Sep 1, 2014
This comment has been minimized.
This comment has been minimized.
|
Welcome)) Thanks you for responding! But please wait. FIX look like: 150 int cursorx_to_position(const char *line, int cursorx, int *prevpos, int maxlen)
151 {
FIX> int utf8strlen = utf8_width(line)-1;
152 int dummy;
153 int i = 0, c = 0, *p = prevpos ? prevpos : &dummy;
154 *p = 0;
155 while(c < cursorx) {
156 const char *utf8str = line + i;
157 int len = ANY_LENGTH;
158 unsigned ch = UTF8_getch(&utf8str, &len);
159 int cw = mk_wcwidth(ch);
160 len = ANY_LENGTH - len;
161
162 if( len <= 0 ) {
163 len = 1;
164 }
165 if(maxlen >= 0 && maxlen < (i + len)) {
166 break;
167 }
168 i += len;
FIX> if (utf8strlen<i) {break;}
169 if( cw <= 0 ) {
170 cw = 1;
171 }
172 c += cw;
173 if( c <= cursorx ) {
174 *p = i;
175 }
176 }
177 return i;
178}Inner loop are not breaking when line+i >= lenght of |
This comment has been minimized.
This comment has been minimized.
|
Initial testing seems to work and not break anything. If you can file a PR, please do so. Otherwise, I can file one on your behalf but will need an e-mail address to do so--Git doesn't want to give you credit based solely on your callsign. A forum PM or IRC message would work; I'm usually on US Eastern evenings, 5-10 PM or so. |
This comment has been minimized.
This comment has been minimized.
|
Mmm.. it's strange. When i debuging calls from |
This comment has been minimized.
This comment has been minimized.
|
We've got an active Russian community on the forum. You might stop in: http://smf.cataclysmdda.com/index.php?board=11.0 |
This comment has been minimized.
This comment has been minimized.
|
Russian community isn't developers community for this game, so as you wish I'll try to stop there:) Thank you :) |
This comment has been minimized.
This comment has been minimized.
|
Feel free to stick around. HuXTUS and Reaper are prominent Russians here, as is illi-kun. Probably a few others I'm forgetting. :-/ Shoot me the e-mail in a forum message or something, if you like. Was tied up and didn't get the chance to get the commit attributed. |
This comment has been minimized.
This comment has been minimized.
|
Well, I don't like shooting but i'll try :P Because this bug too serious :( |
This was referenced Sep 1, 2014
This comment has been minimized.
This comment has been minimized.
|
|
WareXD commentedAug 31, 2014
OS:
Windows XP, SP3.Checked:
0.A Branch: Master. Also seems error in latest experimental SDL (cataclysmdda-0.A-2007)Desc:
Sometime game crashed when trying to select any recipe in Craft Window (simply moving text cursor). Also crashed when rapidly open(key: "*") and close(key:"ESC") Construction window.
Frequent problem. It is not clear what causes it. Occurs spontaneously and only in Craft/Construction windows.
P.S. Sorry, but I'm not C++/C# programmer and not looking good in English. Sorry for that.
But I'll try to help a little for a good game.
Debugger Code::Blocks 13.12:
Call stack:
catacharset.cpp:
I guess, but I can be wrong:
8 unsigned UTF8_getch(const char **src, int *srclen)10 const unsigned char *p = *(const unsigned char **)src;Trouble looking at the absence of an error handler and validating for the string array pointer
pand deeper. There is no validation for externalsrcbefore equate to not initp.16 if (*srclen == 0) { return UNKNOWN_UNICODE; }Is not sufficient to check only lenght of string when also working with its pointer. Pointer
srccan be wrong due error or multithreaded operations and calls and pointerpinit/get "random" from stack. Especially when working with global/external variables/constants without declaring, initialization and releasing local variables.