issue-#149 bug in Kernel.Upper/Lower

Post Reply
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

issue-#149 bug in Kernel.Upper/Lower

Post by Josef Templ »

I found and fixed a severe bug in Kernel.Upper/Lower.

For the issue see https://redmine.blackboxframework.org/issues/149.

For the diffs see https://redmine.blackboxframework.org/p ... 09ddc6ad20.

I found this bug when I tried out a trivial optimization in DevSearch.Find that
crashed BlackBox in a random way because memory was overwritten at a random location.
It was just pure luck so far that it did not occur earlier.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#149 bug in Kernel.Upper/Lower

Post by Josef Templ »

This issue is ready for voting, I think.

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#149 bug in Kernel.Upper/Lower

Post by Ivan Denisov »

The only question. Why ORD(ch), but not S.ADR(ch) ?
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#149 bug in Kernel.Upper/Lower

Post by Josef Templ »

Ivan Denisov wrote:The only question. Why ORD(ch), but not S.ADR(ch) ?
WinApi.CharUpperW can be used for two purposes:
1. for converting a single wide character, passed as a zero extended 32 bit value
2. for converting a wide string in place, passed as its start address.

We use it for converting a single wide character but if the high bits are not zero
it is treated as a string address and then the memory is corrupted.

The msdn docu has all the details.
See https://msdn.microsoft.com/en-us/librar ... s.85).aspx.

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#149 bug in Kernel.Upper/Lower

Post by Ivan Denisov »

Thank you Josef, now I understand better. I also think, that this issue is ready for voting.
Post Reply