tsmf: fix invalid check and a potential segfault
authorNorbert Federa <norbert.federa@thincast.com>
Thu, 28 May 2015 08:49:38 +0000 (10:49 +0200)
committerNorbert Federa <norbert.federa@thincast.com>
Thu, 28 May 2015 08:49:38 +0000 (10:49 +0200)
This resuscitates tsmf which was accidently broken in commit f8120919

channels/tsmf/client/tsmf_media.c

index f4f0e07..4015565 100644 (file)
@@ -288,8 +288,7 @@ TSMF_PRESENTATION* tsmf_presentation_new(const BYTE* guid, IWTSVirtualChannelCal
        CopyMemory(presentation->presentation_id, guid, GUID_SIZE);
        presentation->channel_callback = pChannelCallback;
        presentation->volume = 5000; /* 50% */
-       presentation->stream_list = ArrayList_New(TRUE);
-       if (presentation->stream_list)
+       if (!(presentation->stream_list = ArrayList_New(TRUE)))
                goto error_stream_list;
 
        ArrayList_Object(presentation->stream_list)->fnObjectFree = (OBJECT_FREE_FN) _tsmf_stream_free;
@@ -829,6 +828,9 @@ void tsmf_presentation_set_geometry_info(TSMF_PRESENTATION* presentation,
        TSMF_STREAM* stream;
        void *tmp_rects;
 
+       if (num_rects < 1 || !rects)
+               return;
+
        /* The server may send messages with invalid width / height.
         * Ignore those messages. */
        if (!width || !height)