dviner Fri Oct 4 18:43:55 2002 EDT
Modified files:
/php4/ext/xslt sablot.c xslt.dsp
Log:
adding segfault detection as proposed by Lenar L�hmus [[EMAIL PROTECTED]]
--dviner
Index: php4/ext/xslt/sablot.c
diff -u php4/ext/xslt/sablot.c:1.53 php4/ext/xslt/sablot.c:1.54
--- php4/ext/xslt/sablot.c:1.53 Fri Oct 4 05:22:02 2002
+++ php4/ext/xslt/sablot.c Fri Oct 4 18:43:54 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sablot.c,v 1.53 2002/10/04 09:22:02 msopacua Exp $ */
+/* $Id: sablot.c,v 1.54 2002/10/04 22:43:54 dviner Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -745,13 +745,19 @@
xslt_call_function("scheme get all", XSLT_SCHEME(handle).get_all,
3, argv, &retval);
+ if(!retval) {
+ /* return failure */
+ return 1;
+ }
+
/* Save the return value in the buffer (copying it) */
*buffer = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
*byte_count = Z_STRLEN_P(retval);
/* Free return value */
zval_ptr_dtor(&retval);
-
+
+ /* return success */
return 0;
}
/* }}} */
@@ -823,12 +829,22 @@
xslt_call_function("scheme open", XSLT_SCHEME(handle).open,
3, argv, &retval);
+ if(!retval) {
+ /* return failure */
+ return 1;
+ }
+
/* Return value is a resource pointer to an open file */
*fd = Z_LVAL_P(retval);
-
+
/* Free it all up */
zval_ptr_dtor(&retval);
+ if(!*fd) {
+ /* return failure - unsupported scheme */
+ return SH_ERR_UNSUPPORTED_SCHEME;
+ }
+
/* return success */
return 0;
}
@@ -867,6 +883,11 @@
xslt_call_function("scheme get", XSLT_SCHEME(handle).get,
3, argv, &retval);
+ if(!retval) {
+ /* return failure */
+ return 1;
+ }
+
/* Returns the number of bytes read */
*byte_count = Z_LVAL_P(retval);
@@ -911,6 +932,11 @@
xslt_call_function("scheme put", XSLT_SCHEME(handle).put,
3, argv, &retval);
+ if(!retval) {
+ /* return failure */
+ return 1;
+ }
+
/* The return value is the number of bytes written */
*byte_count = Z_LVAL_P(retval);
@@ -952,6 +978,11 @@
xslt_call_function("scheme close", XSLT_SCHEME(handle).close,
2, argv, &retval);
+ if(!retval) {
+ /* return failure */
+ return 1;
+ }
+
/* Free everything up */
zval_ptr_dtor(&retval);
@@ -986,7 +1017,8 @@
1, argv, &retval);
/* Cleanup */
- zval_ptr_dtor(&retval);
+ if(retval)
+ zval_ptr_dtor(&retval);
}
/* }}} */
@@ -1034,7 +1066,8 @@
3, argv, &retval);
/* Cleanup */
- zval_ptr_dtor(&retval);
+ if(retval)
+ zval_ptr_dtor(&retval);
}
/* }}} */
@@ -1068,7 +1101,8 @@
2, argv, &retval);
/* Cleanup */
- zval_ptr_dtor(&retval);
+ if(retval)
+ zval_ptr_dtor(&retval);
}
/* }}} */
@@ -1107,7 +1141,8 @@
3, argv, &retval);
/* Cleanup */
- zval_ptr_dtor(&retval);
+ if(retval)
+ zval_ptr_dtor(&retval);
}
/* }}} */
@@ -1141,7 +1176,8 @@
2, argv, &retval);
/* Cleanup */
- zval_ptr_dtor(&retval);
+ if(retval)
+ zval_ptr_dtor(&retval);
}
/* }}} */
@@ -1175,7 +1211,8 @@
2, argv, &retval);
/* Cleanup */
- zval_ptr_dtor(&retval);
+ if(retval)
+ zval_ptr_dtor(&retval);
}
/* }}} */
@@ -1214,7 +1251,8 @@
3, argv, &retval);
/* Cleanup */
- zval_ptr_dtor(&retval);
+ if(retval)
+ zval_ptr_dtor(&retval);
}
/* }}} */
@@ -1250,7 +1288,8 @@
2, argv, &retval);
/* Cleanup */
- zval_ptr_dtor(&retval);
+ if(retval)
+ zval_ptr_dtor(&retval);
}
/* }}} */
@@ -1281,7 +1320,8 @@
1, argv, &retval);
/* Cleanup */
- zval_ptr_dtor(&retval);
+ if(retval)
+ zval_ptr_dtor(&retval);
}
/* }}} */
@@ -1499,7 +1539,8 @@
4, argv, &retval);
/* Free up */
- zval_ptr_dtor(&retval);
+ if(retval)
+ zval_ptr_dtor(&retval);
}
else {
char *errmsg = NULL; /* Error
message */
Index: php4/ext/xslt/xslt.dsp
diff -u php4/ext/xslt/xslt.dsp:1.1 php4/ext/xslt/xslt.dsp:1.2
--- php4/ext/xslt/xslt.dsp:1.1 Mon Jun 11 10:53:30 2001
+++ php4/ext/xslt/xslt.dsp Fri Oct 4 18:43:54 2002
@@ -43,7 +43,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D
"_MBCS" /D "_USRDLL" /D "XSLT_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I
"..\..\TSRM" /I "..\..\win32" /D "WIN32" /D "COMPILE_DL_XSLT" /D ZTS=1 /D HAVE_XSLT=1
/D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /D
"HAVE_SABLOT_BACKEND" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I
+"..\..\TSRM" /I "..\..\win32" /I "C:\Program Files\Sablot-0.96\include" /D "WIN32" /D
+"COMPILE_DL_XSLT" /D ZTS=1 /D HAVE_XSLT=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS"
+/D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_SABLOT_BACKEND" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
@@ -53,7 +53,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
/nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib php4ts.lib sablot.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_xslt.dll"
/libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
+# ADD LINK32 kernel32.lib php4ts.lib sablot.lib user32.lib gdi32.lib winspool.lib
+comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
+odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_xslt.dll"
+/libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"C:\Program
+Files\Sablot-0.96\lib"
!ELSEIF "$(CFG)" == "xslt - Win32 Debug_TS"
@@ -68,7 +68,7 @@
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"
/D "_MBCS" /D "_USRDLL" /D "XSLT_EXPORTS" /YX /FD /GZ /c
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"
+/D "_MBCS" /D "_USRDLL" /D "XSLT_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend"
/I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ZTS=1 /D
"ZEND_WIN32" /D "PHP_WIN32" /D HAVE_XSLT=1 /D COMPILE_DL_XSLT=1 /D
"HAVE_SABLOT_BACKEND" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php