changeset 9340:410beb08a2dc 9-b88

Merge
author kcr
date Mon, 19 Oct 2015 13:02:38 -0700
parents 7126f4aed997 2ce783e94c77
children 0082624c57c9 c8d896f6c38c abbd74b4e838 cd63d3100363
files
diffstat 31 files changed, 463 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/modules/fxml/src/main/java/com/sun/javafx/fxml/BeanAdapter.java	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/fxml/src/main/java/com/sun/javafx/fxml/BeanAdapter.java	Mon Oct 19 13:02:38 2015 -0700
@@ -463,12 +463,13 @@
                 coercedValue = new BigDecimal(value.toString());
             }
         } else if (type == Class.class) {
-            try {   
-                ReflectUtil.checkPackageAccess(value.toString());
+            try {
+                final String className = value.toString();
+                ReflectUtil.checkPackageAccess(className);
                 final ClassLoader cl = Thread.currentThread().getContextClassLoader();
                 coercedValue = Class.forName(
-                        value.toString(), 
-                        false, 
+                        className,
+                        false,
                         cl);
             } catch (ClassNotFoundException exception) {
                 throw new IllegalArgumentException(exception);
--- a/modules/graphics/src/main/java/com/sun/javafx/tk/Toolkit.java	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/tk/Toolkit.java	Mon Oct 19 13:02:38 2015 -0700
@@ -194,7 +194,14 @@
                 || (userSpecifiedToolkit && !forcedToolkit.endsWith("StubToolkit"));
 
         try {
-            TOOLKIT = (Toolkit) Class.forName(forcedToolkit).newInstance();
+            Class<?> clz = Class.forName(forcedToolkit, false, Toolkit.class.getClassLoader());
+            // Check that clz is a subclass of Toolkit
+            if (!Toolkit.class.isAssignableFrom(clz)) {
+                throw new IllegalArgumentException("Unrecognized FX Toolkit class: "
+                        + forcedToolkit);
+            }
+
+            TOOLKIT = (Toolkit) clz.newInstance();
             if (TOOLKIT.init()) {
                 if (printToolkit) {
                     System.err.println("JavaFX: using " + forcedToolkit);
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/garray.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/garray.c	Mon Oct 19 13:02:38 2015 -0700
@@ -191,6 +191,11 @@
   g_return_val_if_fail (elt_size > 0, NULL);
 
   array = g_slice_new (GRealArray);
+#ifdef GSTREAMER_LITE
+  if (array == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE 
 
   array->data            = NULL;
   array->len             = 0;
@@ -898,6 +903,11 @@
   GRealPtrArray *array;
 
   array = g_slice_new (GRealPtrArray);
+#ifdef GSTREAMER_LITE
+  if (array == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
 
   array->pdata = NULL;
   array->len = 0;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gatomic.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gatomic.c	Mon Oct 19 13:02:38 2015 -0700
@@ -740,6 +740,12 @@
                     gint           val)
 {
   gint oldval;
+  
+#ifdef GSTREAMER_LITE
+  if (atomic == NULL) {
+    return;
+  }
+#endif // GSTREAMER_LITE
 
   pthread_mutex_lock (&g_atomic_lock);
   oldval = *atomic;
@@ -755,6 +761,12 @@
 {
   guint oldval;
 
+#ifdef GSTREAMER_LITE
+  if (atomic == NULL) {
+    return;
+  }
+#endif // GSTREAMER_LITE
+
   pthread_mutex_lock (&g_atomic_lock);
   oldval = *atomic;
   *atomic = oldval & val;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gbitlock.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gbitlock.c	Mon Oct 19 13:02:38 2015 -0700
@@ -131,6 +131,12 @@
       if ((waiter = g_futex_find_address (address)) == NULL)
         {
           waiter = g_slice_new (WaitAddress);
+#ifdef GSTREAMER_LITE
+          if (waiter == NULL) {
+            g_mutex_unlock (&g_futex_mutex);
+            return;
+          }
+#endif // GSTREAMER_LITE
           waiter->address = address;
           g_cond_init (&waiter->wait_queue);
           waiter->ref_count = 0;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gbookmarkfile.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gbookmarkfile.c	Mon Oct 19 13:02:38 2015 -0700
@@ -262,6 +262,11 @@
   g_warn_if_fail (name != NULL);
   
   retval = g_slice_new (BookmarkAppInfo);
+#ifdef GSTREAMER_LITE
+  if (retval == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   
   retval->name = g_strdup (name);
   retval->exec = NULL;
@@ -327,6 +332,11 @@
   BookmarkMetadata *retval;
   
   retval = g_slice_new (BookmarkMetadata);
+#ifdef GSTREAMER_LITE
+  if (retval == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
 
   retval->mime_type = NULL;
   
@@ -505,6 +515,12 @@
   g_warn_if_fail (uri != NULL);
   
   item = g_slice_new (BookmarkItem);
+#ifdef GSTREAMER_LITE
+  if (item == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
+
   item->uri = g_strdup (uri);
   
   item->title = NULL;
@@ -771,7 +787,12 @@
   
   g_warn_if_fail (parse_data->current_item == NULL);
   
-  item = bookmark_item_new (uri);
+item = bookmark_item_new (uri);
+#ifdef GSTREAMER_LITE
+  if (item == NULL) {
+    return;
+  }
+#endif // GSTREAMER_LITE
   
   if (added)
     item->added = timestamp_from_iso8601 (added);
@@ -857,6 +878,14 @@
   if (!ai)
     {
       ai = bookmark_app_info_new (name);
+#ifdef GSTREAMER_LITE
+      if (ai == NULL) {
+          g_set_error (error, G_MARKUP_ERROR,
+      		   G_MARKUP_ERROR_INVALID_CONTENT,
+      		   _("AI is NULL"));
+          return;
+      }
+#endif GSTREAMER_LITE
       
       if (!item->metadata)
 	item->metadata = bookmark_metadata_new ();
@@ -3202,6 +3231,11 @@
       else
         {
           ai = bookmark_app_info_new (name);
+#ifdef GSTREAMER_LITE
+          if (ai == NULL) {
+            return FALSE;
+          }
+#endif // GSTREAMER_LITE
           
           item->metadata->applications = g_list_prepend (item->metadata->applications, ai);
           g_hash_table_replace (item->metadata->apps_by_name, ai->name, ai);
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gchecksum.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gchecksum.c	Mon Oct 19 13:02:38 2015 -0700
@@ -1500,6 +1500,11 @@
   g_return_val_if_fail (checksum != NULL, NULL);
 
   copy = g_slice_new (GChecksum);
+#ifdef GSTREAMER_LITE
+  if (copy == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   *copy = *checksum;
 
   copy->digest_str = g_strdup (checksum->digest_str);
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gdataset.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gdataset.c	Mon Oct 19 13:02:38 2015 -0700
@@ -573,6 +573,12 @@
   if (!dataset)
     {
       dataset = g_slice_new (GDataset);
+#ifdef GSTREAMER_LITE
+      if (dataset == NULL) {
+        G_UNLOCK (g_dataset_global);
+        return;
+      }
+#endif // GSTREAMER_LITE
       dataset->location = dataset_location;
       g_datalist_init (&dataset->datalist);
       g_hash_table_insert (g_dataset_location_ht, 
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gerror.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gerror.c	Mon Oct 19 13:02:38 2015 -0700
@@ -382,6 +382,11 @@
   g_warn_if_fail (format != NULL);
 
   error = g_slice_new (GError);
+#ifdef GSTREAMER_LITE
+  if (error == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
 
   error->domain = domain;
   error->code = code;
@@ -445,6 +450,11 @@
   g_return_val_if_fail (domain != 0, NULL);
 
   err = g_slice_new (GError);
+#ifdef GSTREAMER_LITE
+  if (err == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
 
   err->domain = domain;
   err->code = code;
@@ -488,6 +498,11 @@
   g_warn_if_fail (error->message != NULL);
 
   copy = g_slice_new (GError);
+#ifdef GSTREAMER_LITE
+  if (copy == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
 
   *copy = *error;
 
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/ghash.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/ghash.c	Mon Oct 19 13:02:38 2015 -0700
@@ -654,6 +654,11 @@
   GHashTable *hash_table;
 
   hash_table = g_slice_new (GHashTable);
+#ifdef GSTREAMER_LITE
+  if (hash_table == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   g_hash_table_set_shift (hash_table, HASH_TABLE_MIN_SHIFT);
   hash_table->nnodes             = 0;
   hash_table->noccupied          = 0;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gkeyfile.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gkeyfile.c	Mon Oct 19 13:02:38 2015 -0700
@@ -1178,6 +1178,12 @@
   g_warn_if_fail (key_file->current_group != NULL);
 
   pair = g_slice_new (GKeyFileKeyValuePair);
+#ifdef GSTREAMER_LITE
+  if (pair == NULL) {
+    g_warn_if_fail(pair != NULL);
+    return;
+  }
+#endif // GSTREAMER_LITE
   pair->key = NULL;
   pair->value = g_strndup (line, length);
   
@@ -1303,6 +1309,14 @@
       GKeyFileKeyValuePair *pair;
 
       pair = g_slice_new (GKeyFileKeyValuePair);
+#ifdef GSTREAMER_LITE
+      if (pair == NULL) {
+        if (locale != NULL) {
+          g_free (locale);
+        }
+        return;
+      }
+#endif // GSTREAMER_LITE
       pair->key = key;
       pair->value = value;
 
@@ -1998,6 +2012,11 @@
   g_return_if_fail (list != NULL || length == 0);
 
   value_list = g_string_sized_new (length * 128);
+#ifdef GSTREAMER_LITE
+  if (value_list == NULL) {
+    return;
+  }
+#endif // GSTREAMER_LITE
   for (i = 0; i < length && list[i] != NULL; i++)
     {
       gchar *value;
@@ -2242,6 +2261,11 @@
   g_return_if_fail (length != 0);
 
   value_list = g_string_sized_new (length * 128);
+#ifdef GSTREAMER_LITE
+  if (value_list == NULL) {
+    return;
+  }
+#endif // GSTREAMER_LITE
   for (i = 0; i < length && list[i] != NULL; i++)
     {
       gchar *value;
@@ -2458,6 +2482,11 @@
   g_return_if_fail (list != NULL);
 
   value_list = g_string_sized_new (length * 8);
+#ifdef GSTREAMER_LITE
+  if (value_list == NULL) {
+    return;
+  }
+#endif // GSTREAMER_LITE
   for (i = 0; i < length; i++)
     {
       gchar *value;
@@ -2826,6 +2855,11 @@
   g_return_if_fail (list != NULL);
 
   values = g_string_sized_new (length * 16);
+#ifdef GSTREAMER_LITE
+  if (values == NULL) {
+    return;
+  }
+#endif // GSTREAMER_LITE
   for (i = 0; i < length; i++)
     {
       gchar *value;
@@ -3039,6 +3073,11 @@
   g_return_if_fail (list != NULL);
 
   values = g_string_sized_new (length * 16);
+#ifdef GSTREAMER_LITE
+  if (values == NULL) {
+    return;
+  }
+#endif // GSTREAMER_LITE
   for (i = 0; i < length; i++)
     {
       gchar result[G_ASCII_DTOSTR_BUF_SIZE];
@@ -3112,6 +3151,11 @@
   /* Now we can add our new comment
    */
   pair = g_slice_new (GKeyFileKeyValuePair);
+#ifdef GSTREAMER_LITE
+  if (pair == NULL) {
+    return FALSE;
+  }
+#endif // GSTREAMER_LITE
   pair->key = NULL;
   pair->value = g_key_file_parse_comment_as_value (key_file, comment);
   
@@ -3155,6 +3199,11 @@
   /* Now we can add our new comment
    */
   group->comment = g_slice_new (GKeyFileKeyValuePair);
+#ifdef GSTREAMER_LITE
+  if (group->comment == NULL) {
+    return FALSE;
+  }
+#endif // GSTREAMER_LITE
   group->comment->key = NULL;
   group->comment->value = g_key_file_parse_comment_as_value (key_file, comment);
 
@@ -3188,6 +3237,11 @@
      return TRUE;
 
   pair = g_slice_new (GKeyFileKeyValuePair);
+#ifdef GSTREAMER_LITE
+  if (pair == NULL) {
+    return FALSE;
+  }
+#endif // GSTREAMER_LITE
   pair->key = NULL;
   pair->value = g_key_file_parse_comment_as_value (key_file, comment);
   
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/glist.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/glist.c	Mon Oct 19 13:02:38 2015 -0700
@@ -256,6 +256,11 @@
   GList *last;
   
   new_list = _g_list_alloc ();
+#ifdef GSTREAMER_LITE
+  if (new_list == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   new_list->data = data;
   new_list->next = NULL;
   
@@ -306,6 +311,11 @@
   GList *new_list;
   
   new_list = _g_list_alloc ();
+#ifdef GSTREAMER_LITE
+  if (new_list == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   new_list->data = data;
   new_list->next = list;
   
@@ -352,6 +362,11 @@
     return g_list_append (list, data);
 
   new_list = _g_list_alloc ();
+#ifdef GSTREAMER_LITE
+  if (new_list == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   new_list->data = data;
   new_list->prev = tmp_list->prev;
   tmp_list->prev->next = new_list;
@@ -389,6 +404,11 @@
       GList *node;
 
       node = _g_list_alloc ();
+#ifdef GSTREAMER_LITE
+      if (node == NULL) {
+        return NULL;
+      }
+#endif // GSTREAMER_LITE
       node->data = data;
       node->prev = sibling->prev;
       node->next = sibling;
@@ -413,6 +433,11 @@
         last = last->next;
 
       last->next = _g_list_alloc ();
+#ifdef GSTREAMER_LITE
+      if (last->next == NULL) {
+        return NULL;
+      }
+#endif // GSTREAMER_LITE
       last->next->data = data;
       last->next->prev = last;
       last->next->next = NULL;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gmain.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gmain.c	Mon Oct 19 13:02:38 2015 -0700
@@ -1141,6 +1141,12 @@
 		 GMainContext *context)
 {
   guint result = 0;
+  
+#ifdef GSTREAMER_LITE
+  if (source == NULL) {
+    return 0;
+  }
+#endif // GSTREAMER_LITE
 
   g_return_val_if_fail (source->context == NULL, 0);
   g_return_val_if_fail (!SOURCE_DESTROYED (source), 0);
@@ -4179,6 +4185,11 @@
 {
   GPollRec *prevrec, *nextrec;
   GPollRec *newrec = g_slice_new (GPollRec);
+#ifdef GSTREAMER_LITE
+  if (newrec == NULL) {
+    return;
+  }
+#endif // GSTREAMER_LITE
 
   /* This file descriptor may be checked before we ever poll */
   fd->revents = 0;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gmarkup.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gmarkup.c	Mon Oct 19 13:02:38 2015 -0700
@@ -2092,6 +2092,11 @@
   GMarkupRecursionTracker *tracker;
 
   tracker = g_slice_new (GMarkupRecursionTracker);
+#ifdef GSTREAMER_LITE
+  if (tracker == NULL) {
+    return;
+  }
+#endif // GSTREAMER_LITE
   tracker->prev_element = context->subparser_element;
   tracker->prev_parser = context->parser;
   tracker->prev_user_data = context->user_data;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gstring.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gstring.c	Mon Oct 19 13:02:38 2015 -0700
@@ -119,6 +119,11 @@
 g_string_sized_new (gsize dfl_size)
 {
   GString *string = g_slice_new (GString);
+#ifdef GSTREAMER_LITE
+  if (string == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
 
   string->allocated_len = 0;
   string->len   = 0;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gtree.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gtree.c	Mon Oct 19 13:02:38 2015 -0700
@@ -134,6 +134,11 @@
                  gpointer value)
 {
   GTreeNode *node = g_slice_new (GTreeNode);
+#ifdef GSTREAMER_LITE
+  if (node == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
 
   node->balance = 0;
   node->left = NULL;
@@ -215,6 +220,11 @@
   g_return_val_if_fail (key_compare_func != NULL, NULL);
   
   tree = g_slice_new (GTree);
+#ifdef GSTREAMER_LITE
+  if (tree == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   tree->root               = NULL;
   tree->key_compare        = key_compare_func;
   tree->key_destroy_func   = key_destroy_func;
@@ -486,6 +496,11 @@
           else
             {
               GTreeNode *child = g_tree_node_new (key, value);
+#ifdef GSTREAMER_LITE
+              if (child == NULL) {
+                return;
+              }
+#endif // GSTREAMER_LITE
 
               child->left = node->left;
               child->right = node;
@@ -508,6 +523,11 @@
           else
             {
               GTreeNode *child = g_tree_node_new (key, value);
+#ifdef GSTREAMER_LITE
+              if (child == NULL) {
+                return;
+              }
+#endif // GSTREAMER_LITE
 
               child->right = node->right;
               child->left = node;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/guniprop.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/guniprop.c	Mon Oct 19 13:02:38 2015 -0700
@@ -893,12 +893,21 @@
    * We use a two pass approach to keep memory management simple
    */
   result_len = real_toupper (str, len, NULL, locale_type);
+#ifdef GSTREAMER_LITE
+  if (result_len == 0)
+    return NULL;
+#endif // GSTREAMER_LITE
   result = g_malloc (result_len + 1);
 #ifdef GSTREAMER_LITE
   if (result == NULL)
-      return NULL;
+    return NULL;
 #endif // GSTREAMER_LITE
+#ifdef GSTREAMER_LITE
+  if (real_toupper (str, len, result, locale_type) == 0)
+    return NULL;
+#else // GSTREAMER_LITE
   real_toupper (str, len, result, locale_type);
+#endif // GSTREAMER_LITE  
   result[result_len] = '\0';
 
   return result;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gvariant-core.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gvariant-core.c	Mon Oct 19 13:02:38 2015 -0700
@@ -474,6 +474,11 @@
   GVariant *value;
 
   value = g_slice_new (GVariant);
+#ifdef GSTREAMER_LITE
+  if (value == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   value->type_info = g_variant_type_info_get (type);
   value->state = (serialised ? STATE_SERIALISED : 0) |
                  (trusted ? STATE_TRUSTED : 0) |
@@ -510,6 +515,11 @@
   gsize size;
 
   value = g_variant_alloc (type, TRUE, trusted);
+#ifdef GSTREAMER_LITE
+  if (value == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
 
   value->contents.serialised.bytes = g_bytes_ref (bytes);
 
@@ -563,6 +573,11 @@
   GVariant *value;
 
   value = g_variant_alloc (type, FALSE, trusted);
+#ifdef GSTREAMER_LITE
+  if (value == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   value->contents.tree.children = children;
   value->contents.tree.n_children = n_children;
 
@@ -1007,6 +1022,11 @@
 
     /* create a new serialised instance out of it */
     child = g_slice_new (GVariant);
+#ifdef GSTREAMER_LITE
+    if (child == NULL) {
+      return NULL;
+    }
+#endif // GSTREAMER_LITE
     child->type_info = s_child.type_info;
     child->state = (value->state & STATE_TRUSTED) |
                    STATE_SERIALISED;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gvariant.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gvariant.c	Mon Oct 19 13:02:38 2015 -0700
@@ -2910,6 +2910,11 @@
   GVariantIter *iter;
 
   iter = (GVariantIter *) g_slice_new (struct heap_iter);
+#ifdef GSTREAMER_LITE
+  if (iter == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   GVHI(iter)->value_ref = g_variant_ref (value);
   GVHI(iter)->magic = GVHI_MAGIC;
 
@@ -2970,6 +2975,12 @@
 g_variant_iter_copy (GVariantIter *iter)
 {
   GVariantIter *copy;
+  
+#ifdef GSTREAMER_LITE
+  if (iter == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
 
   g_return_val_if_fail (is_valid_iter (iter), 0);
 
@@ -3169,6 +3180,11 @@
   GVariantBuilder *builder;
 
   builder = (GVariantBuilder *) g_slice_new (struct heap_builder);
+#ifdef GSTREAMER_LITE
+  if (builder == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   g_variant_builder_init (builder, type);
   GVHB(builder)->magic = GVHB_MAGIC;
   GVHB(builder)->ref_count = 1;
@@ -5801,6 +5817,11 @@
       g_variant_serialised_byteswap (serialised);
 
       bytes = g_bytes_new_take (serialised.data, serialised.size);
+#ifdef GSTREAMER_LITE
+      if (bytes == NULL) {
+        return NULL;
+      }
+#endif // GSTREAMER_LITE
       new = g_variant_new_from_bytes (g_variant_get_type (value), bytes, TRUE);
       g_bytes_unref (bytes);
     }
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gvarianttypeinfo.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/glib/gvarianttypeinfo.c	Mon Oct 19 13:02:38 2015 -0700
@@ -279,6 +279,11 @@
   ArrayInfo *info;
 
   info = g_slice_new (ArrayInfo);
+#ifdef GSTREAMER_LITE
+  if (info == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   info->container.info.container_class = GV_ARRAY_INFO_CLASS;
 
   info->element = g_variant_type_info_get (g_variant_type_element (type));
@@ -660,6 +665,11 @@
   TupleInfo *info;
 
   info = g_slice_new (TupleInfo);
+#ifdef GSTREAMER_LITE
+  if (info == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   info->container.info.container_class = GV_TUPLE_INFO_CLASS;
 
   tuple_allocate_members (type, &info->members, &info->n_members);
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/gobject/gatomicarray.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/gobject/gatomicarray.c	Mon Oct 19 13:02:38 2015 -0700
@@ -75,6 +75,11 @@
 
   real_size = sizeof (gsize) + MAX (size, sizeof (FreeListNode));
   mem = g_slice_alloc (real_size);
+#ifdef GSTREAMER_LITE
+  if (mem == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   mem = ((char *) mem) + sizeof (gsize);
   G_ATOMIC_ARRAY_DATA_SIZE (mem) = size;
   return mem;
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/gobject/gsignal.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/gobject/gsignal.c	Mon Oct 19 13:02:38 2015 -0700
@@ -454,6 +454,11 @@
   HandlerMatch *node;
   
   node = g_slice_new (HandlerMatch);
+#ifdef GSTREAMER_LITE
+  if (node == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   node->handler = handler;
   node->next = list;
   node->signal_id = signal_id;
@@ -1245,6 +1250,12 @@
   keys = g_bsearch_array_get_nth (g_signal_key_bsa, &g_signal_key_bconfig, 0);
   n_nodes = g_bsearch_array_get_n_nodes (g_signal_key_bsa);
   result = g_array_new (FALSE, FALSE, sizeof (guint));
+#ifdef GSTREAMER_LITE
+  if (result == NULL) {
+    SIGNAL_UNLOCK ();
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   
   for (i = 0; i < n_nodes; i++)
     if (keys[i].itype == itype)
--- a/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/gobject/gvaluearray.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/3rd_party/glib/glib-2.42.1/gobject/gvaluearray.c	Mon Oct 19 13:02:38 2015 -0700
@@ -136,6 +136,11 @@
 g_value_array_new (guint n_prealloced)
 {
   GValueArray *value_array = g_slice_new (GValueArray);
+#ifdef GSTREAMER_LITE
+  if (value_array == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
 
   value_array->n_values = 0;
   value_array->n_prealloced = 0;
@@ -192,6 +197,11 @@
   g_return_val_if_fail (value_array != NULL, NULL);
 
   new_array = g_slice_new (GValueArray);
+#ifdef GSTREAMER_LITE
+  if (new_array == NULL) {
+    return NULL;
+  }
+#endif // GSTREAMER_LITE
   new_array->n_values = 0;
   new_array->values = NULL;
   new_array->n_prealloced = 0;
--- a/modules/media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/wavparse/gstwavparse.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/gstreamer-lite/gst-plugins-good/gst/wavparse/gstwavparse.c	Mon Oct 19 13:02:38 2015 -0700
@@ -1310,6 +1310,11 @@
             }
             gst_adapter_flush (wav->adapter, 8);
             data = gst_adapter_map (wav->adapter, data_size);
+#ifdef GSTREAMER_LITE
+            if (data == NULL) {
+                goto header_read_error;
+            }
+#endif // GSTREAMER_LITE
             wav->fact = GST_READ_UINT32_LE (data);
             gst_adapter_unmap (wav->adapter);
             gst_adapter_flush (wav->adapter, GST_ROUND_UP_2 (size));
--- a/modules/media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gststructure.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gststructure.c	Mon Oct 19 13:02:38 2015 -0700
@@ -2488,6 +2488,11 @@
   g_return_val_if_fail (IS_MUTABLE (structure), FALSE);
 
   value = gst_structure_get_value (structure, field_name);
+#ifdef GSTREAMER_LITE
+  if (value == NULL) {
+    return FALSE;
+  }
+#endif // GSTREAMER_LITE  
 
   if (G_VALUE_TYPE (value) == G_TYPE_INT) {
     /* already fixed */
@@ -2552,6 +2557,11 @@
   g_return_val_if_fail (IS_MUTABLE (structure), FALSE);
 
   value = gst_structure_get_value (structure, field_name);
+#ifdef GSTREAMER_LITE
+  if (value == NULL) {
+    return FALSE;
+  }
+#endif // GSTREAMER_LITE
 
   if (G_VALUE_TYPE (value) == G_TYPE_DOUBLE) {
     /* already fixed */
@@ -2617,6 +2627,11 @@
   g_return_val_if_fail (IS_MUTABLE (structure), FALSE);
 
   value = gst_structure_get_value (structure, field_name);
+#ifdef GSTREAMER_LITE
+  if (value == NULL) {
+    return FALSE;
+  }
+#endif // GSTREAMER_LITE
 
   if (G_VALUE_TYPE (value) == G_TYPE_BOOLEAN) {
     /* already fixed */
@@ -2670,6 +2685,11 @@
   g_return_val_if_fail (IS_MUTABLE (structure), FALSE);
 
   value = gst_structure_get_value (structure, field_name);
+#ifdef GSTREAMER_LITE
+  if (value == NULL) {
+    return FALSE;
+  }
+#endif // GSTREAMER_LITE
 
   if (G_VALUE_TYPE (value) == G_TYPE_STRING) {
     /* already fixed */
@@ -2727,6 +2747,11 @@
   g_return_val_if_fail (target_denominator != 0, FALSE);
 
   value = gst_structure_get_value (structure, field_name);
+#ifdef GSTREAMER_LITE
+  if (value == NULL) {
+    return FALSE;
+  }
+#endif // GSTREAMER_LITE  
 
   if (G_VALUE_TYPE (value) == GST_TYPE_FRACTION) {
     /* already fixed */
--- a/modules/media/src/main/native/gstreamer/gstreamer-lite/gstreamer/libs/gst/base/gstbaseparse.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/gstreamer-lite/gstreamer/libs/gst/base/gstbaseparse.c	Mon Oct 19 13:02:38 2015 -0700
@@ -1986,12 +1986,18 @@
       pts = gst_adapter_prev_pts (parse->priv->adapter, NULL);
       dts = gst_adapter_prev_dts (parse->priv->adapter, NULL);
       outbuf = gst_adapter_take_buffer (parse->priv->adapter, *skip);
+#ifdef GSTREAMER_LITE
+      if (outbuf != NULL) {
+#endif // GSTREAMER_LITE
       outbuf = gst_buffer_make_writable (outbuf);
       GST_BUFFER_PTS (outbuf) = pts;
       GST_BUFFER_DTS (outbuf) = dts;
       parse->priv->buffers_head =
           g_slist_prepend (parse->priv->buffers_head, outbuf);
       outbuf = NULL;
+#ifdef GSTREAMER_LITE
+      }
+#endif // GSTREAMER_LITE
     } else {
       gst_adapter_flush (parse->priv->adapter, *skip);
     }
--- a/modules/media/src/main/native/gstreamer/plugins/audioconverter/audioconverter.c	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/gstreamer/plugins/audioconverter/audioconverter.c	Mon Oct 19 13:02:38 2015 -0700
@@ -506,24 +506,32 @@
                     gst_event_unref (event);
                 }
             }
-            if (!result) {
-                SInt64 absolutePacketOffset = start / decode->frame_duration;
-                SInt64 absoluteByteOffset;
-                UInt32 flags = 0;
-                if(noErr == AudioFileStreamSeek(decode->audioStreamID, absolutePacketOffset,
-                                                &absoluteByteOffset, &flags)) {
-                    start_byte = (gint64)absoluteByteOffset;
-                    result = gst_pad_push_event(decode->sinkpad,
-                                                gst_event_new_seek(rate, GST_FORMAT_BYTES,
-                                                                   (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
-                                                                   GST_SEEK_TYPE_SET, start_byte,
-                                                                   GST_SEEK_TYPE_NONE, 0));
-                    if (result)
-                    {
-                        // INLINE - gst_event_unref()
-                        gst_event_unref (event);
+            
+            if (!result) 
+            {
+                if (decode->frame_duration != 0) 
+                {
+                    SInt64 absolutePacketOffset = start / decode->frame_duration;
+                    SInt64 absoluteByteOffset;
+                    UInt32 flags = 0;
+                    if(noErr == AudioFileStreamSeek(decode->audioStreamID, absolutePacketOffset,
+                                                    &absoluteByteOffset, &flags)) {
+                        start_byte = (gint64)absoluteByteOffset;
+                        result = gst_pad_push_event(decode->sinkpad,
+                                                    gst_event_new_seek(rate, GST_FORMAT_BYTES,
+                                                                       (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
+                                                                       GST_SEEK_TYPE_SET, start_byte,
+                                                                       GST_SEEK_TYPE_NONE, 0));
+                        if (result)
+                        {
+                            // INLINE - gst_event_unref()
+                            gst_event_unref (event);
+                        }
                     }
                 }
+                else
+                    gst_element_message_full(GST_ELEMENT(decode), GST_MESSAGE_ERROR, GST_STREAM_ERROR, GST_STREAM_ERROR_DECODE, 
+                                             g_strdup("Zero frame duration"), NULL, ("audioconverter.c"), ("audioconverter_src_event"), 0);
             }
         }
     }
@@ -906,11 +914,19 @@
             }
         }
 
+        // Check frame duration for zero to avoid division by zero.
+        if (decode->frame_duration == 0) 
+        {
+            gst_element_message_full(GST_ELEMENT(decode), GST_MESSAGE_ERROR, GST_STREAM_ERROR, GST_STREAM_ERROR_DECODE, 
+                                     g_strdup("Zero frame duration"), NULL, ("audioconverter.c"), ("audioconverter_chain"), 0);
+            ret = GST_FLOW_ERROR;
+            goto _exit;
+        }
+        
         // Derive sample count using the timestamp.
         guint64 frame_index = buf_time/decode->frame_duration;
         decode->total_samples = frame_index * decode->samples_per_frame;
 
-
         // Set the sink and source pad caps if not already done.
         if (TRUE != decode->has_pad_caps)
         {
--- a/modules/media/src/main/native/jfxmedia/Utils/JavaUtils.m	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/jfxmedia/Utils/JavaUtils.m	Mon Oct 19 13:02:38 2015 -0700
@@ -46,7 +46,13 @@
     jstring outString = 0;
     
     if (NULL != env && nil != ns) {
-        NSInteger length = [ns length];
+        jsize length;
+        if (ns.length > INT32_MAX) {
+            // overflow protection: NSUInteger is 64 bit ulong, jsize is 32 bit int
+            length = INT32_MAX-1;
+        } else {
+            length = (jsize)ns.length;
+        }
         unichar *strBuf = malloc(length * sizeof(unichar));
         if (!strBuf) {
             return 0;
--- a/modules/media/src/main/native/jfxmedia/platform/gstreamer/GstAVPlaybackPipeline.cpp	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/jfxmedia/platform/gstreamer/GstAVPlaybackPipeline.cpp	Mon Oct 19 13:02:38 2015 -0700
@@ -344,11 +344,18 @@
             delete pVideoFrame;
             return GST_FLOW_OK;
         }
-        if (!pPipeline->m_pEventDispatcher->SendNewFrameEvent(pVideoFrame))
-        {
-            if (!pPipeline->m_pEventDispatcher->SendPlayerMediaErrorEvent(ERROR_JNI_SEND_NEW_FRAME_EVENT))
+        if (pVideoFrame->IsValid()) {
+            if (!pPipeline->m_pEventDispatcher->SendNewFrameEvent(pVideoFrame))
             {
-                LOGGER_LOGMSG(LOGGER_ERROR, "Cannot send media error event.\n");
+                if (!pPipeline->m_pEventDispatcher->SendPlayerMediaErrorEvent(ERROR_JNI_SEND_NEW_FRAME_EVENT))
+                {
+                    LOGGER_LOGMSG(LOGGER_ERROR, "Cannot send media error event.\n");
+                }
+            }
+        } else {
+            delete pVideoFrame;
+            if (pPipeline->m_pEventDispatcher != NULL) {
+                pPipeline->m_pEventDispatcher->Warning(WARNING_GSTREAMER_INVALID_FRAME, "Invalid frame");
             }
         }
     }
--- a/modules/media/src/main/native/jfxmedia/platform/gstreamer/GstVideoFrame.cpp	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/jfxmedia/platform/gstreamer/GstVideoFrame.cpp	Mon Oct 19 13:02:38 2015 -0700
@@ -237,6 +237,7 @@
     m_pulPlaneSize[0] = m_pulPlaneSize[1] = m_pulPlaneSize[2] = m_pulPlaneSize[3] = 0;
     m_piPlaneStrides[0] = m_piPlaneStrides[1] = m_piPlaneStrides[2] = m_piPlaneStrides[3] = 0;
 
+    unsigned long expectedSize = 0;
     switch (m_typeFrame) {
         case YCbCr_420p: {
             int offset;
@@ -256,6 +257,7 @@
             gst_structure_get_int(str, "offset-y", &offset);
             m_pulPlaneSize[0] = m_piPlaneStrides[0] * m_iEncodedHeight;
             m_pvPlaneData[0] = (void*)((intptr_t)m_pvBufferBaseAddress + offset);
+            expectedSize += m_pulPlaneSize[0];
 
             //
             // Chroma offsets assume YV12 ordering
@@ -264,11 +266,13 @@
             gst_structure_get_int(str, "offset-v", &offset);
             m_pulPlaneSize[1] = m_piPlaneStrides[1] * (m_iEncodedHeight/2);
             m_pvPlaneData[1] = (void*)((intptr_t)m_pvBufferBaseAddress + offset);
+            expectedSize += m_pulPlaneSize[1];
 
             offset += m_pulPlaneSize[1];
             gst_structure_get_int(str, "offset-u", &offset);
             m_pulPlaneSize[2] = m_piPlaneStrides[2] * (m_iEncodedHeight/2);
             m_pvPlaneData[2] = (void*)((intptr_t)m_pvBufferBaseAddress + offset);
+            expectedSize += m_pulPlaneSize[2];
 
             // process alpha channel (before we potentially swap Cb/Cr)
             if (m_bHasAlpha) {
@@ -281,6 +285,7 @@
                 gst_structure_get_int(str, "offset-a", &offset);
                 m_pulPlaneSize[3] = m_piPlaneStrides[3] * m_iEncodedHeight;
                 m_pvPlaneData[3] = (void*)((intptr_t)m_pvBufferBaseAddress + offset);
+                expectedSize += m_pulPlaneSize[3];
             }
 
             //
@@ -304,8 +309,11 @@
             }
             m_pulPlaneSize[0] = m_piPlaneStrides[0] * m_iEncodedHeight;
             m_pvPlaneData[0] = m_pvBufferBaseAddress;
+            expectedSize += m_pulPlaneSize[0];
             break;
     }
+
+    m_bIsValid = m_bIsValid && (expectedSize <= m_ulBufferSize);
 }
 
 bool CGstVideoFrame::IsValid()
--- a/modules/media/src/main/native/jfxmedia/platform/osx/avf/AVFMediaPlayer.mm	Fri Oct 16 13:24:08 2015 -0700
+++ b/modules/media/src/main/native/jfxmedia/platform/osx/avf/AVFMediaPlayer.mm	Mon Oct 19 13:02:38 2015 -0700
@@ -59,6 +59,32 @@
 // Apple really likes to output '2vuy', this should be the least expensive conversion
 #define FALLBACK_VO_FORMAT kCVPixelFormatType_422YpCbCr8
 
+#define FOURCC_CHAR(f) ((f) & 0x7f) ? (char)((f) & 0x7f) : '?'
+
+static inline NSString *FourCCToNSString(UInt32 fcc) {
+    if (fcc < 0x100) {
+        return [NSString stringWithFormat:@"%u", fcc];
+    }
+    return [NSString stringWithFormat:@"%c%c%c%c",
+            FOURCC_CHAR(fcc >> 24),
+            FOURCC_CHAR(fcc >> 16),
+            FOURCC_CHAR(fcc >> 8),
+            FOURCC_CHAR(fcc)];
+}
+
+#if DUMP_TRACK_INFO
+static void append_log(NSMutableString *s, NSString *fmt, ...) {
+    va_list args;
+    va_start(args, fmt);
+    NSString *appString = [[NSString alloc] initWithFormat:fmt arguments:args];
+    [s appendFormat:@"%@\n", appString];
+    va_end(args);
+}
+#define TRACK_LOG(fmt, ...) append_log(trackLog, fmt, ##__VA_ARGS__)
+#else
+#define TRACK_LOG(...) {}
+#endif
+
 @implementation AVFMediaPlayer
 
 static void SpectrumCallbackProc(void *context, double duration);
@@ -199,26 +225,34 @@
 // If we get an unsupported pixel format in the video output, call this to
 // force it to output our fallback format
 - (void) setFallbackVideoFormat {
-    AVPlayerItemVideoOutput *newOutput =
+    // schedule this to be done when we're not buried inside the AVPlayer callback
+    __weak AVFMediaPlayer *blockSelf = self; // retain cycle avoidance
+    dispatch_async(dispatch_get_main_queue(), ^{
+        LOGGER_DEBUGMSG(([[NSString stringWithFormat:@"Falling back on video format: %@", FourCCToNSString(FALLBACK_VO_FORMAT)] UTF8String]));
+        AVPlayerItemVideoOutput *newOutput =
         [[AVPlayerItemVideoOutput alloc] initWithPixelBufferAttributes:
          @{(id)kCVPixelBufferPixelFormatTypeKey: @(FALLBACK_VO_FORMAT)}];
 
-    if (newOutput) {
-        CVDisplayLinkStop(_displayLink);
-        [_playerItem removeOutput:_playerOutput];
-        [_playerOutput setDelegate:nil queue:nil];
+        if (newOutput) {
+            CVDisplayLinkStop(_displayLink);
+            [_playerItem removeOutput:_playerOutput];
+            [_playerOutput setDelegate:nil queue:nil];
 
-        self.playerOutput = newOutput;
-        [_playerOutput setDelegate:self queue:playerQueue];
-        [_playerOutput requestNotificationOfMediaDataChangeWithAdvanceInterval:ADVANCE_INTERVAL_IN_SECONDS];
-        [_playerItem addOutput:_playerOutput];
-    }
+            self.playerOutput = newOutput;
+            [_playerOutput setDelegate:blockSelf queue:playerQueue];
+            [_playerOutput requestNotificationOfMediaDataChangeWithAdvanceInterval:ADVANCE_INTERVAL_IN_SECONDS];
+            [_playerItem addOutput:_playerOutput];
+        }
+    });
 }
 
 - (void) createVideoOutput {
     @synchronized(self) {
         // Skip if already created
         if (!_playerOutput) {
+#if FORCE_VO_FORMAT
+            LOGGER_DEBUGMSG(([[NSString stringWithFormat:@"Forcing VO format: %@", FourCCToNSString(FORCED_VO_FORMAT)] UTF8String]));
+#endif
             // Create the player video output
             // kCVPixelFormatType_32ARGB comes out inverted, so don't use it
             // '2vuy' -> kCVPixelFormatType_422YpCbCr8 -> YCbCr_422 (uses less CPU too)
@@ -393,21 +427,6 @@
     }
 }
 
-#if DUMP_TRACK_INFO
-static void append_log(NSMutableString *s, NSString *fmt, ...) {
-    va_list args;
-    va_start(args, fmt);
-    NSString *appString = [[NSString alloc] initWithFormat:fmt arguments:args];
-    [s appendFormat:@"%@\n", appString];
-    va_end(args);
-}
-#define TRACK_LOG(fmt, ...) append_log(trackLog, fmt, ##__VA_ARGS__)
-#else
-#define TRACK_LOG(...) {}
-#endif
-
-#define FOURCC_CHAR(f) ((f)&0xff)?(char)((f)&0xff):'?'
-
 - (void) extractTrackInfo {
 #if DUMP_TRACK_INFO
     NSMutableString *trackLog = [[NSMutableString alloc] initWithFormat:
@@ -468,11 +487,8 @@
         TRACK_LOG(@"  enabled: %s", track.enabled ? "YES" : "NO");
         TRACK_LOG(@"  track ID: %d", track.trackID);
         TRACK_LOG(@"  language code: %@ (%sprovided)", lang, track.languageCode ? "" : "NOT ");
-        TRACK_LOG(@"  encoding (FourCC): '%c%c%c%c' (JFX encoding %d)",
-                  FOURCC_CHAR(fcc>>24),
-                  FOURCC_CHAR(fcc>>16),
-                  FOURCC_CHAR(fcc>>8),
-                  FOURCC_CHAR(fcc),
+        TRACK_LOG(@"  encoding (FourCC): '%@' (JFX encoding %d)",
+                  FourCCToNSString(fcc),
                   (int)encoding);
 
         // Tracks in AVFoundation don't have names, so we'll need to give them
@@ -594,7 +610,15 @@
     } catch (const char *message) {
         // Check if the video format is supported, if not try our fallback format
         OSType format = CVPixelBufferGetPixelFormatType(buf);
+        if (format == 0) {
+            // Bad pixel format, possibly a bad frame or ???
+            // This seems to happen when the stream is corrupt, so let's ignore
+            // it and hope things recover
+            return;
+        }
         if (!CVVideoFrame::IsFormatSupported(format)) {
+            LOGGER_DEBUGMSG(([[NSString stringWithFormat:@"Bad pixel format: '%@'",
+                               FourCCToNSString(format)] UTF8String]));
             [self setFallbackVideoFormat];
             return;
         }