RFC: usp10/tests: Reserve for InClass a byte for every character in teststr.

Nikolay Sivov bunglehead at gmail.com
Wed Aug 3 02:42:02 CDT 2016


On 03.08.2016 0:33, Bernhard √úbelacker wrote:
> https://bugs.winehq.org/show_bug.cgi?id=40385
> 
> ScriptStringAnalyse crashes if InClass is just one byte in size
> followed by memory marked as PAGE_NOACCESS.
> By testing the size it seems it should have the same size as characters
> in teststr are given to the function.
> ---
>  dlls/usp10/tests/usp10.c | 103 +++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 95 insertions(+), 8 deletions(-)
> 
> diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
> index 6b2152f..7eb0592 100644
> --- a/dlls/usp10/tests/usp10.c
> +++ b/dlls/usp10/tests/usp10.c
> @@ -2900,7 +2900,7 @@ static void test_ScriptString(HDC hdc)
>      DWORD           Flags = SSA_GLYPHS;
>      int             ReqWidth = 100;
>      const int       Dx[5] = {10, 10, 10, 10, 10};
> -    const BYTE      InClass = 0;
> +    const BYTE      InClass[len];
>      SCRIPT_STRING_ANALYSIS ssa = NULL;
>  
>      int             X = 10; 
> @@ -2916,29 +2916,30 @@ static void test_ScriptString(HDC hdc)
>  
>  
>      Charset = -1;     /* this flag indicates unicode input */
> +    memset((void*)InClass, 0, sizeof(InClass));

Instead of using len, it should be either use a constant, or be
allocated dynamically, otherwise you'll get compiler warning with
default flags we're building with.

I think it would be easier to make it 'static const BYTE InClass[32];'
(or whatever length is appropriate).

Otherwise it looks reasonable, thanks for working on this.




More information about the wine-devel mailing list