From: Jan Vorlicek Date: Wed, 1 Apr 2015 23:31:53 +0000 (+0200) Subject: Fix FormatMessageW in PAL X-Git-Tag: accepted/tizen/base/20180629.140029~6892^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c8a58b8d07835f3919478a786fdb188d5a4e2d9;p=platform%2Fupstream%2Fcoreclr.git Fix FormatMessageW in PAL The function was not properly accessing the Arguments list when the FORMAT_MESSAGE_ARGUMENT_ARRAY flag was set. The va_list on Linux is a struct with four members, so indexing Arguments array without casting it first to a WCHAR** gets completely wrong results. --- diff --git a/src/pal/src/misc/fmtmessage.cpp b/src/pal/src/misc/fmtmessage.cpp index 8003b7c..53dcd67 100644 --- a/src/pal/src/misc/fmtmessage.cpp +++ b/src/pal/src/misc/fmtmessage.cpp @@ -711,7 +711,7 @@ FormatMessageW( if ( !bIsVaList ) { - lpInsertString = (LPWSTR)Arguments[ Index - 1 ]; + lpInsertString = ((LPWSTR*)Arguments)[ Index - 1 ]; } else { @@ -791,7 +791,7 @@ FormatMessageW( if ( !bIsVaList ) { - lpInsert = (LPWSTR)Arguments[ Index - 1 ]; + lpInsert = ((LPWSTR*)Arguments)[Index - 1]; } else {