Lines 18-24
Link Here
|
18 |
+----------------------------------------------------------------------+ |
18 |
+----------------------------------------------------------------------+ |
19 |
*/ |
19 |
*/ |
20 |
|
20 |
|
21 |
/* $Id: gd.c,v 1.221.2.56.2.1 2005/10/06 20:44:52 iliaa Exp $ */ |
21 |
/* $Id: gd.c,v 1.221.2.56.2.3 2005/11/03 20:20:04 sniper Exp $ */ |
22 |
|
22 |
|
23 |
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, |
23 |
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, |
24 |
Cold Spring Harbor Labs. */ |
24 |
Cold Spring Harbor Labs. */ |
Lines 623-629
Link Here
|
623 |
|
623 |
|
624 |
convert_to_string_ex(file); |
624 |
convert_to_string_ex(file); |
625 |
|
625 |
|
626 |
stream = php_stream_open_wrapper(Z_STRVAL_PP(file), "rb", IGNORE_PATH | IGNORE_URL_WIN | REPORT_ERRORS, NULL); |
626 |
stream = php_stream_open_wrapper(Z_STRVAL_PP(file), "rb", ENFORCE_SAFE_MODE | IGNORE_PATH | IGNORE_URL_WIN | REPORT_ERRORS, NULL); |
627 |
if (stream == NULL) { |
627 |
if (stream == NULL) { |
628 |
RETURN_FALSE; |
628 |
RETURN_FALSE; |
629 |
} |
629 |
} |
Lines 807-812
Link Here
|
807 |
convert_to_boolean_ex(dither); |
807 |
convert_to_boolean_ex(dither); |
808 |
convert_to_long_ex(ncolors); |
808 |
convert_to_long_ex(ncolors); |
809 |
|
809 |
|
|
|
810 |
if (Z_LVAL_PP(ncolors) <= 0) { |
811 |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of colors has to be greater than zero"); |
812 |
RETURN_FALSE; |
813 |
} |
810 |
gdImageTrueColorToPalette(im, Z_LVAL_PP(dither), Z_LVAL_PP(ncolors)); |
814 |
gdImageTrueColorToPalette(im, Z_LVAL_PP(dither), Z_LVAL_PP(ncolors)); |
811 |
|
815 |
|
812 |
RETURN_TRUE; |
816 |
RETURN_TRUE; |
Lines 1436-1442
Link Here
|
1436 |
|
1440 |
|
1437 |
fn = Z_STRVAL_PP(file); |
1441 |
fn = Z_STRVAL_PP(file); |
1438 |
|
1442 |
|
1439 |
stream = php_stream_open_wrapper(fn, "rb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL); |
1443 |
stream = php_stream_open_wrapper(fn, "rb", ENFORCE_SAFE_MODE|REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL); |
1440 |
if (stream == NULL) { |
1444 |
if (stream == NULL) { |
1441 |
RETURN_FALSE; |
1445 |
RETURN_FALSE; |
1442 |
} |
1446 |
} |
Lines 1644-1653
Link Here
|
1644 |
} |
1648 |
} |
1645 |
|
1649 |
|
1646 |
if ((argc == 2) || (argc > 2 && Z_STRLEN_PP(file))) { |
1650 |
if ((argc == 2) || (argc > 2 && Z_STRLEN_PP(file))) { |
1647 |
if (!fn || fn == empty_string || php_check_open_basedir(fn TSRMLS_CC) || (PG(safe_mode) && !php_checkuid(fn, "rb+", CHECKUID_CHECK_FILE_AND_DIR))) { |
1651 |
PHP_GD_CHECK_OPEN_BASEDIR(fn, "Invalid filename"); |
1648 |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid filename '%s'", fn); |
|
|
1649 |
RETURN_FALSE; |
1650 |
} |
1651 |
|
1652 |
|
1652 |
fp = VCWD_FOPEN(fn, "wb"); |
1653 |
fp = VCWD_FOPEN(fn, "wb"); |
1653 |
if (!fp) { |
1654 |
if (!fp) { |
Lines 3742-3757
Link Here
|
3742 |
} |
3743 |
} |
3743 |
|
3744 |
|
3744 |
/* Check origin file */ |
3745 |
/* Check origin file */ |
3745 |
if (!fn_org || fn_org == empty_string || php_check_open_basedir(fn_org TSRMLS_CC)) { |
3746 |
PHP_GD_CHECK_OPEN_BASEDIR(fn_org, "Invalid origin filename"); |
3746 |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid origin filename '%s'", fn_org); |
|
|
3747 |
RETURN_FALSE; |
3748 |
} |
3749 |
|
3747 |
|
3750 |
/* Check destination file */ |
3748 |
/* Check destination file */ |
3751 |
if (!fn_dest || fn_dest == empty_string || php_check_open_basedir(fn_dest TSRMLS_CC)) { |
3749 |
PHP_GD_CHECK_OPEN_BASEDIR(fn_dest, "Invalid destination filename"); |
3752 |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid destination filename '%s'", fn_dest); |
|
|
3753 |
RETURN_FALSE; |
3754 |
} |
3755 |
|
3750 |
|
3756 |
/* Open origin file */ |
3751 |
/* Open origin file */ |
3757 |
org = VCWD_FOPEN(fn_org, "rb"); |
3752 |
org = VCWD_FOPEN(fn_org, "rb"); |