php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #69769
Patch solaris-iconv-patch revision 2015-09-22 18:48 UTC by etmsys at rit dot edu

Patch solaris-iconv-patch for Reproducible crash Bug #69769

Patch version 2015-09-22 18:48 UTC

Return to Bug #69769 | Download this patch
Patch Revisions:

Developer: etmsys@rit.edu

--- php-5.6.13/ext/iconv/iconv.c	Tue Sep 22 14:22:14 2015
+++ 14/php-5.6.13/ext/iconv/iconv.c	Tue Sep 22 14:02:57 2015
@@ -41,20 +41,12 @@
 
 #ifdef HAVE_ICONV
 
-#ifdef PHP_ICONV_H_PATH
-#include PHP_ICONV_H_PATH
-#else
-#include <iconv.h>
-#endif
+#include "/usr/include/iconv.h"
 
 #ifdef HAVE_GLIBC_ICONV
 #include <gnu/libc-version.h>
 #endif
 
-#ifdef HAVE_LIBICONV
-#undef iconv
-#endif
-
 #include "ext/standard/php_smart_str.h"
 #include "ext/standard/base64.h"
 #include "ext/standard/quot_print.h"
@@ -277,15 +269,6 @@
 	REGISTER_INI_ENTRIES();
 
 #if HAVE_LIBICONV
-	{
-		static char buf[16];
-		snprintf(buf, sizeof(buf), "%d.%d",
-		    ((_libiconv_version >> 8) & 0x0f), (_libiconv_version & 0x0f));
-		version = buf;
-	}
-#elif HAVE_GLIBC_ICONV
-	version = (char *)gnu_get_libc_version();
-#elif defined(NETWARE)
 	version = "OS built-in";
 #endif
 
@@ -463,7 +446,7 @@
 
 			out_p = (d)->c + (d)->len;
 
-			if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
+			if (iconv(cd, (const char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
 #if ICONV_SUPPORTS_ERRNO
 				switch (errno) {
 					case EINVAL:
@@ -650,7 +633,7 @@
 	out_p = out_buf;
 
 	while (in_left > 0) {
-		result = iconv(cd, (char **) &in_p, &in_left, (char **) &out_p, &out_left);
+		result = iconv(cd, (const char **) &in_p, &in_left, (char **) &out_p, &out_left);
 		out_size = bsz - out_left;
 		if (result == (size_t)(-1)) {
 			if (ignore_ilseq && errno == EILSEQ) {
@@ -775,7 +758,7 @@
 
 		prev_in_left = in_left;
 
-		if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
+		if (iconv(cd, (const char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
 			if (prev_in_left == in_left) {
 				break;
 			}
@@ -896,7 +879,7 @@
 
 		prev_in_left = in_left;
 
-		if (iconv(cd1, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
+		if (iconv(cd1, (const char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
 			if (prev_in_left == in_left) {
 				break;
 			}
@@ -1028,7 +1011,7 @@
 
 		prev_in_left = in_left;
 
-		if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
+		if (iconv(cd, (const char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
 			if (prev_in_left == in_left) {
 #if ICONV_SUPPORTS_ERRNO
 				switch (errno) {
@@ -1277,7 +1260,7 @@
 
 					out_left = out_size - out_reserved;
 
-					if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
+					if (iconv(cd, (const char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
 #if ICONV_SUPPORTS_ERRNO
 						switch (errno) {
 							case EINVAL:
@@ -1377,7 +1360,7 @@
 					out_p = buf;
 					out_left = out_size;
 
-					if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
+					if (iconv(cd, (const char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
 #if ICONV_SUPPORTS_ERRNO
 						switch (errno) {
 							case EINVAL:
@@ -2650,7 +2633,7 @@
 		tcnt = self->stub_len;
 
 		while (tcnt > 0) {
-			if (iconv(self->cd, &pt, &tcnt, &pd, &ocnt) == (size_t)-1) {
+			if (iconv(self->cd, (const char **) &pt, &tcnt, &pd, &ocnt) == (size_t)-1) {
 #if ICONV_SUPPORTS_ERRNO
 				switch (errno) {
 					case EILSEQ:
@@ -2729,7 +2712,7 @@
 
 	while (icnt > 0) {
 		if ((ps == NULL ? iconv(self->cd, NULL, NULL, &pd, &ocnt):
-					iconv(self->cd, (char **)&ps, &icnt, &pd, &ocnt)) == (size_t)-1) {
+					iconv(self->cd, (const char **)&ps, &icnt, &pd, &ocnt)) == (size_t)-1) {
 #if ICONV_SUPPORTS_ERRNO
 			switch (errno) {
 				case EILSEQ:
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Nov 17 19:01:35 2019 UTC