Return -1 on invalid input instead of crashing.
authorJean-Tiare Le Bigot <jtlebi@gmail>
Wed, 25 May 2011 18:12:17 +0000 (20:12 +0200)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Wed, 25 May 2011 18:12:17 +0000 (20:12 +0200)
libswscale/utils.c

index 56920a1..fada192 100644 (file)
@@ -710,7 +710,7 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange
 
 int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)
 {
-    if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
+    if (!c || isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
 
     *inv_table = c->srcColorspaceTable;
     *table     = c->dstColorspaceTable;