xmllite: Add Unknown to map (Coverity)

André Hentschel nerv at dawncrow.de
Wed Feb 1 12:22:53 CST 2017


Am 31.01.2017 um 05:17 schrieb Nikolay Sivov:
> On 31.01.2017 1:11, André Hentschel wrote:
>> CID 1364307
>>
>> Signed-off-by: André Hentschel <nerv at dawncrow.de>
>> ---
>>  dlls/xmllite/reader.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c
>> index 1e3c7aa..f99ea66 100644
>> --- a/dlls/xmllite/reader.c
>> +++ b/dlls/xmllite/reader.c
>> @@ -85,6 +85,7 @@ typedef enum
>>  
>>  static const WCHAR utf16W[] = {'U','T','F','-','1','6',0};
>>  static const WCHAR utf8W[] = {'U','T','F','-','8',0};
>> +static const WCHAR unknownW[] = {'U','n','k','n','o','w','n',0};
>>  
>>  static const WCHAR dblquoteW[] = {'\"',0};
>>  static const WCHAR quoteW[] = {'\'',0};
>> @@ -151,8 +152,9 @@ struct xml_encoding_data
>>  };
>>  
>>  static const struct xml_encoding_data xml_encoding_map[] = {
>> -    { utf16W, XmlEncoding_UTF16, ~0 },
>> -    { utf8W,  XmlEncoding_UTF8,  CP_UTF8 }
>> +    { utf16W,   XmlEncoding_UTF16,      ~0 },
>> +    { utf8W,    XmlEncoding_UTF8,       CP_UTF8 },
>> +    { unknownW, XmlEncoding_Unknown,    ~0 },
>>  };
>>  
>>  const WCHAR *get_encoding_name(xml_encoding encoding)
>>
> 
> I don't think this fixes anything in a sense of making xmllite more
> compliant. We probably should just fail at
> CreateXmlWriterOutputWithEncodingName() and print encoding string that
> made it fail.
> 
> 

It's about those lines in reader_parse_nextnode:
                hr = readerinput_detectencoding(reader->input, &enc);
                TRACE("detected encoding %s, 0x%08x\n", debugstr_w(xml_encoding_map[enc].name), hr);
enc migth end up being XmlEncoding_Unknown (and hr is S_OK) and there is no entry for unknown in xml_encoding_map, so the TRACE would read behind the array



More information about the wine-devel mailing list