msi(1/3): Don't crash if rec is NULL

James Hawkins truiken at
Fri Sep 14 12:30:21 CDT 2007

On 9/14/07, Juan Lang <juan.lang at> wrote:
> > MSI_FormatRecordW is an internal function and we should be crashing if
> > rec is NULL.
> Are you sure?  This is causing the iTunes installer to crash for a
> couple people.  Besides, I don't think the code is written with this
> assumption in mind.  In deformat_string_internal:
> static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
>                                      WCHAR** data, DWORD len, MSIRECORD* record,
>                                      INT* failcount)
> ...
>     if (ptr==NULL)
>     {
>         TRACE("Deformatting NULL string\n");
>         *data = NULL;
>         return 0;
>     }
> So deformat_string_internal handles NULL correctly.  This patch
> changes one of the call sites to avoid dereferencing a NULL pointer
> before passing it to a function that deals with a NULL input.

The public APIs check for bad records and return ERROR_INVALID_HANDLE,
so they will never send in a NULL rec.  Something internally is
sending in a NULL rec, and that needs to be fixed.

James Hawkins

More information about the wine-devel mailing list