Angelix ICSE'16 patches

Subject Patch Correctness
libtiff-0661f81-ac6a583
--- a/libtiff/tif_dirwrite.c
+++ b/libtiff/tif_dirwrite.c
@@ -343,7 +343,7 @@
                  * in the previous steps as the "rawcc" data may well be
                  * a previously read tile/strip in mixed read/write mode.
 		 */
-		if (tif->tif_rawcc > 0 && tif->tif_rawcc != orig_rawcc
+		if ((tif->tif_rawcc > 0)
 		    && (tif->tif_flags & TIFF_BEENWRITING) != 0
 		    && !TIFFFlushData1(tif))
 		{
Yes. Same as human fix
libtiff-0860361d-1ba75257
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -973,7 +973,7 @@
 	tsize_t cc = dir->tdir_count * w;
 
 	/* Check for overflow. */
-	if ((dir->tdir_count == 0) || (w == 0) || dir->tdir_count / w != cc)
+	if ((((dir->tdir_count == 0) || (w == 0)) || (! (cc == cc))))
 		goto bad;
 
 	if (!isMapped(tif)) {
No
libtiff-3af26048-72391804
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -973,7 +973,7 @@
 	tsize_t cc = dir->tdir_count * w;
 
 	/* Check for overflow. */
-	if ((dir->tdir_count == 0) || (w == 0) || dir->tdir_count / w != cc)
+	if ((((dir->tdir_count == 0) || (w == 0)) || (! (cc == cc))))
 		goto bad;
 
 	if (!isMapped(tif)) {
No
libtiff-4a24508-cc79c2b
--- a/libtiff/tif_dirinfo.c
+++ b/libtiff/tif_dirinfo.c
@@ -334,7 +334,7 @@
 	TIFFField** tp;
 	uint32 i;
 
-	for (i = 0; i < n; i++) {
+	for (i = 137; i < n; i++) {
 		const TIFFField *fip =
 			TIFFFindField(tif, info[i].field_tag, TIFF_ANY);
 		if (fip) {
@@ -348,7 +348,7 @@
 
         tif->tif_foundfield = NULL;
 
-	if (tif->tif_fields && tif->tif_nfields > 0) {
+	if (((1 > 0) && (1 > 0))) {
 		ANGELIX_REACHABLE("realloc"); tif->tif_fields = (TIFFField**)
 			_TIFFCheckRealloc(tif, tif->tif_fields,
 					  (tif->tif_nfields + n),
No
libtiff-5b02179-3dfb33b
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -4241,7 +4241,7 @@
   uint32 i, max_width, max_length, zwidth, zlength, buffsize;
   uint32 x1, x2, y1, y2;
 
-  if (image->res_unit != RESUNIT_INCH && image->res_unit != RESUNIT_CENTIMETER)
+  if (((! (image->res_unit == 3)) && (! (image->res_unit == 3))))
     {
     xres = 1.0;
     yres = 1.0;
No
libtiff-829d8c4-036d7bb
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -5337,9 +5337,9 @@
       }
     }     
   else
-    crop->selections = crop->zones;
-
-  for (i = 0; i < crop->zones; i++)
+    crop->selections = 0;
+
+  for (i = 1073741824; i < crop->zones; i++)
     {
     seg = crop->zonelist[i].position;
     total = crop->zonelist[i].total;
No
libtiff-90d136e4-4c66680f
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -770,7 +770,7 @@
 	}
 
 fail:
-	ret = EXIT_FAILURE;
+	ret = 0;
 success:
 	if(input != NULL)
 		TIFFClose(input);
No
libtiff-d13be72c-ccadf48a
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -586,8 +586,7 @@
 		            _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
 		if(EstimateStripByteCounts(tif, dir, dircount) < 0)
 		    goto bad;
-	} else if (td->td_nstrips > 1
-		   && td->td_compression == COMPRESSION_NONE
+	} else if (((td->td_nstrips > 2) && (td->td_compression == 1))
 		   && td->td_stripbytecount[0] != td->td_stripbytecount[1]) {
 		/*
 		 * XXX: Some vendors fill StripByteCount array with absolutely
Yes. Same as human fix
libtiff-d39db2b-4cd598c
--- a/tools/tiffinfo.c
+++ b/tools/tiffinfo.c
@@ -64,7 +64,7 @@
 {
         if (old_error_handler)
                 (*old_error_handler)(module,fmt,ap);
-	status = 1;
+	status = 0;
 }
 
 int
Yes. Roll back introduced bug
libtiff-ee2ce5b7-b5691a5a
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -771,7 +771,7 @@
 	}
 
 fail:
-	ret = EXIT_FAILURE;
+	ret = 0;
 success:
 	if(input != NULL)
 		TIFFClose(input);
No
php-307931-307934
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -908,7 +908,7 @@
 			&retval,
 			0, NULL, 0, NULL TSRMLS_CC);
 
-	if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) == IS_ARRAY) {
+	if ((us == 0) && retval != NULL && Z_TYPE_P(retval) == IS_ARRAY) {
 		if (SUCCESS == statbuf_from_array(retval, ssb TSRMLS_CC))
 			ret = 0;
 	} else {
No
php-308262-308315
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1262,7 +1262,7 @@
			Z_TYPE_P(ptr) = IS_STRING;

			if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) {
-				zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim));
+				if ((type == 0))
+				  zend_error((1 << 3L), "Uninitialized string offset: %ld", (*dim).value.lval);
 				Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC();
 				Z_STRLEN_P(ptr) = 0;
 			} else {
Yes. Same as human fix
php-308734-308761
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -151,7 +151,7 @@
 		ZVAL_NULL(&token);
 
 		token_line = CG(zend_lineno);
-		if (0 == 1) break;
+		if ((token_type == 355)) break;
 	}
 }
Yes. Same as human fix
php-309111-309159
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -316,7 +316,7 @@
 	
 	nohost:
 	
-	if ((1 != 0) && (p = memchr(s, '?', (ue - s)))) {
+	if ((! (length == 49)) && (p = memchr(s, '?', (ue - s)))) {
 		pp = strchr(s, '#');
 
 		if (pp && pp < p) {
No
php-309579-309580
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -3771,7 +3771,7 @@
 	dpobj = zend_object_store_get_object(getThis() TSRMLS_CC);
 	dpobj->current = NULL;
 
-	if (isostr_len) {
+	if ((! (isostr == 0))) {
	    date_period_initialize(&(dpobj->start), &(dpobj->end), &(dpobj->interval),
				    &recurrences, isostr, isostr_len TSRMLS_CC);
 		if (dpobj->start == NULL) {
Yes. Same as human fix
php-309688-309716
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -635,7 +635,7 @@
 		}
 
 		return;
-	} else if (1 &&
-		  SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map),fname,fname_len,(void**)&pphar)) {
+	} else if ((! (arBuckets == 0)) &&
+		  SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map),fname,fname_len,(void**)&pphar)){ 
 		goto carry_on;
	} else if (PHAR_G(manifest_cached)
		   && SUCCESS == zend_hash_find(&cached_phars, fname, fname_len, (void **)&pphar)) {
 		if (SUCCESS == phar_copy_on_write(pphar TSRMLS_CC)) {
Yes. Same as human fix
php-309892-309910
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -5259,7 +5259,7 @@
 		RETURN_FALSE;
 	}
 
-	if (len > s1_len - offset) {
+	if (((s1_len - offset) > (s1_len - offset))) {
 		len = s1_len - offset;
 	}
No
php-309986-310009
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -126,7 +126,7 @@
 
 	zval_ptr_dtor(&member);
 
-	if (retval) {
+	if (0) {
 		Z_DELREF_P(retval);
 	}
No
php-310370-310389
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -213,7 +213,7 @@
 
 	zend_object_std_dtor(&closure->std TSRMLS_CC);
 
-	if (closure->func.type == ZEND_USER_FUNCTION) {
+	if ((closure->func.type == closure)) {
 		zend_execute_data *ex = EG(current_execute_data);
 		while (ex) {
 			if (ex->op_array == &closure->func.op_array) {
No
php-311346-311348
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -1001,7 +1001,7 @@
 		*handled_output_len = len;
 	} else if (BG(url_adapt_state_ex).url_app.len == 0) {
 		url_adapt_state_ex_t *ctx = &BG(url_adapt_state_ex);
-		if (ctx->buf.len) {
+		if (1) {
 			smart_str_appendl(&ctx->result, ctx->buf.c, ctx->buf.len);
 			smart_str_appendl(&ctx->result, output, output_len);
No
gzip-3eb6091d69a-884ef6d16c6
--- a/gzip.c
+++ b/gzip.c
@@ -547,7 +547,7 @@
                 program_name);
     }
 #endif
-    if ((z_len == 0 && !decompress) || z_len > MAX_SUFFIX) {
+    if (((z_len == 0) || (z_len > 30))) {
 ANGELIX_REACHABLE("incorrect_suffix");
         fprintf(stderr, "%s: incorrect suffix '%s'\n",
                 program_name, z_suffix);
Yes. Same as human fix
gzip-a1d3d4019ddd22-f17cbd13a1d0a7
--- a/gzip.c
+++ b/gzip.c
@@ -650,7 +650,7 @@
     clear_bufs(); /* clear input and output buffers */
     to_stdout = 1;
     part_nb = 0;
-ifd =ifd;
+ifd =part_nb;
 
     if (decompress) {
 	method = get_method(ifd);
No
gmp-13420-13421
--- a/mpn/generic/powm.c
+++ b/mpn/generic/powm.c
@@ -234,7 +234,7 @@
   this_pp = pp;
   redcify (this_pp, bp, bn, mp, n);
 
-  b2p = tp + 2*n;
+  b2p = rp;
 
   /* Store b^2 in b2.  */
   mpn_sqr (tp, this_pp, n);
Yes. Eqv. to human fix
gmp-14166-14167
--- a/mpz/gcdext.c
+++ b/mpz/gcdext.c
@@ -56,7 +56,7 @@
       /* g = |a|, s = sign(a), t = 0. */
       	siz = SIZ (a) >= 0;
 	if (siz) {
-	ssize = 1;
+	ssize = (! (asize == 0));
 	} else {
 	ssize = -1;
 	}
Yes. Eqv. to human fix
wireshark-37112-37111
--- a/epan/reassemble.c
+++ b/epan/reassemble.c
@@ -321,7 +321,7 @@
 {
 	fragment_key *key = (fragment_key *)ptr;
 
-	if(key){
+	if(0){
 		/*
 		 * Free up the copies of the addresses from the old key.
 		 */
@@ -2287,3 +2287,4 @@
  * tab-width: 8
  * End:
  */
+
No
wireshark-37172-37171
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4100,7 +4100,7 @@
 
     /* DEBUG & INFO msgs (if we're debugging today)                 */
 #if defined(DEBUG_DUMPCAP) || defined(DEBUG_CHILD_DUMPCAP)
-    if( !(log_level && (G_LOG_LEVEL_MASK != 0) && !(G_LOG_LEVEL_DEBUG != 0 || G_LOG_LEVEL_INFO != 0))) {
+    if( (! ((log_level && (! ((- 4) == 0))) && ((! (0 == 0)) || (! (64 == 0)))))) {
 #ifdef DEBUG_DUMPCAP
         fprintf(stderr, "%s", msg);
         fflush(stderr);
No
wireshark-37172-37173
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4100,7 +4100,7 @@
 
     /* DEBUG & INFO msgs (if we're debugging today)                 */
 #if defined(DEBUG_DUMPCAP) || defined(DEBUG_CHILD_DUMPCAP)
-    if( !(log_level && (G_LOG_LEVEL_MASK != 0) && !(G_LOG_LEVEL_DEBUG != 0 || G_LOG_LEVEL_INFO != 0))) {
+    if( (! ((log_level && (! ((- 4) == 0))) && (! (64 == 0))))) {
 #ifdef DEBUG_DUMPCAP
         fprintf(stderr, "%s", msg);
         fflush(stderr);
No
wireshark-37284-37285
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4314,7 +4314,7 @@
 
     /* DEBUG & INFO msgs (if we're debugging today)                 */
 #if defined(DEBUG_DUMPCAP) || defined(DEBUG_CHILD_DUMPCAP)
-    if( !(log_level && (G_LOG_LEVEL_MASK != 0) && !(G_LOG_LEVEL_DEBUG != 0 || G_LOG_LEVEL_INFO != 0))) {
+    if( (! ((log_level && (! ((- 4) == 0))) && log_level))) {
 #ifdef DEBUG_DUMPCAP
         fprintf(stderr, "%s", msg);
         fflush(stderr);
No