From af05015a693ef28cf6a38e449a375d4593a41253 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 27 May 2014 01:13:22 +0200 Subject: [PATCH 1/7] [ticket/12582] Add script for strippping ICC profiles from images. PHPBB3-12582 --- phpBB/develop/strip_icc_profiles.sh | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 phpBB/develop/strip_icc_profiles.sh diff --git a/phpBB/develop/strip_icc_profiles.sh b/phpBB/develop/strip_icc_profiles.sh new file mode 100755 index 0000000000..c9c77bda38 --- /dev/null +++ b/phpBB/develop/strip_icc_profiles.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# @copyright (c) 2014 phpBB Group +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# +set -e +set -x + +SCRIPT=$(basename "$0") +if [ "$#" -ne 1 ]; then + echo "Description: Finds and strips ICC Profiles from image files." >&2 + echo "Usage: $SCRIPT /root/directory" >&2 + echo "Exit Status: 0 if no ICC profiles have been stripped, otherwise 1." >&2 + echo "Requires: exiftool" >&2 + exit 1 +fi + +ROOT=$1 +STATUS=0 +for FILE in $(find "$ROOT" -type f -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$') +do + HASH_OLD=$(md5sum "$FILE") + exiftool -icc_profile"-<=" "$FILE" > /dev/null 2>&1 + HASH_NEW=$(md5sum "$FILE") + + if [ "$HASH_OLD" != "$HASH_NEW" ] + then + echo "Stripped ICC Profile from $FILE." + STATUS=1 + fi +done + +exit $STATUS From ac3bc458742d662199079c291a051b1fa7f41b1a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 27 May 2014 01:21:02 +0200 Subject: [PATCH 2/7] [ticket/12582] Overwrite inplace instead of creating _original files. PHPBB3-12582 --- phpBB/develop/strip_icc_profiles.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/develop/strip_icc_profiles.sh b/phpBB/develop/strip_icc_profiles.sh index c9c77bda38..5bf602242a 100755 --- a/phpBB/develop/strip_icc_profiles.sh +++ b/phpBB/develop/strip_icc_profiles.sh @@ -20,7 +20,7 @@ STATUS=0 for FILE in $(find "$ROOT" -type f -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$') do HASH_OLD=$(md5sum "$FILE") - exiftool -icc_profile"-<=" "$FILE" > /dev/null 2>&1 + exiftool -icc_profile"-<=" -overwrite_original_in_place "$FILE" > /dev/null 2>&1 HASH_NEW=$(md5sum "$FILE") if [ "$HASH_OLD" != "$HASH_NEW" ] From 4f9aa5e3843eb4e8e6b808b294b81649e1c435f3 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 27 May 2014 01:42:42 +0200 Subject: [PATCH 3/7] [ticket/12582] Run strip_icc_profiles.sh on Travis CI. PHPBB3-12582 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 26744c57ef..015f99bd23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,10 +22,12 @@ before_script: - sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.2' ]; then php ../composer.phar install --dev --no-interaction --prefer-source; fi" - cd .. - sh -c "if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` = "1" ]; then travis/setup-webserver.sh; fi" + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then sudo apt-get update; sudo apt-get install -y libimage-exiftool-perl; fi" script: - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then phpunit --configuration travis/phpunit-$DB-5-2-travis.xml; else phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml; fi" - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi" + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then phpBB/develop/strip_icc_profiles.sh ./; fi" matrix: include: From c02fba3f1c17bd5ffd780409a64a612a0e6d1d03 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 27 May 2014 16:56:45 +0200 Subject: [PATCH 4/7] [ticket/12582] Change strip_icc_profiles.sh to only take a single file. PHPBB3-12582 --- .travis.yml | 4 ++-- phpBB/develop/strip_icc_profiles.sh | 31 +++++++++++------------------ 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 015f99bd23..0358500adc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,12 +22,12 @@ before_script: - sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.2' ]; then php ../composer.phar install --dev --no-interaction --prefer-source; fi" - cd .. - sh -c "if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` = "1" ]; then travis/setup-webserver.sh; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then sudo apt-get update; sudo apt-get install -y libimage-exiftool-perl; fi" + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then sudo apt-get update; sudo apt-get install -y parallel libimage-exiftool-perl; fi" script: - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then phpunit --configuration travis/phpunit-$DB-5-2-travis.xml; else phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml; fi" - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then phpBB/develop/strip_icc_profiles.sh ./; fi" + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then find . -type f -not -path './phpBB/vendor/*' -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$' | parallel --gnu --keep-order 'phpBB/develop/strip_icc_profiles.sh {}' || exit 1; fi" matrix: include: diff --git a/phpBB/develop/strip_icc_profiles.sh b/phpBB/develop/strip_icc_profiles.sh index 5bf602242a..69431fbac2 100755 --- a/phpBB/develop/strip_icc_profiles.sh +++ b/phpBB/develop/strip_icc_profiles.sh @@ -4,30 +4,23 @@ # @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 # set -e -set -x -SCRIPT=$(basename "$0") if [ "$#" -ne 1 ]; then - echo "Description: Finds and strips ICC Profiles from image files." >&2 - echo "Usage: $SCRIPT /root/directory" >&2 + SCRIPT=$(basename "$0") + echo "Description: Finds and strips ICC Profiles from given image file." >&2 + echo "Usage: $SCRIPT /path/to/image/file" >&2 echo "Exit Status: 0 if no ICC profiles have been stripped, otherwise 1." >&2 echo "Requires: exiftool" >&2 exit 1 fi -ROOT=$1 -STATUS=0 -for FILE in $(find "$ROOT" -type f -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$') -do - HASH_OLD=$(md5sum "$FILE") - exiftool -icc_profile"-<=" -overwrite_original_in_place "$FILE" > /dev/null 2>&1 - HASH_NEW=$(md5sum "$FILE") +FILE=$1 +HASH_OLD=$(md5sum "$FILE") +exiftool -icc_profile"-<=" -overwrite_original_in_place "$FILE" > /dev/null 2>&1 +HASH_NEW=$(md5sum "$FILE") - if [ "$HASH_OLD" != "$HASH_NEW" ] - then - echo "Stripped ICC Profile from $FILE." - STATUS=1 - fi -done - -exit $STATUS +if [ "$HASH_OLD" != "$HASH_NEW" ] +then + echo "Stripped ICC Profile from $FILE." + exit 1 +fi From b485318ba9e9831c87e7c33decf80bf74f350125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Pr=C3=A9vot?= Date: Wed, 21 May 2014 17:16:23 -0400 Subject: [PATCH 5/7] [ticket/12582] Strip away copyrighted ICC profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This images embed a non free ICC profile that doesn’t allow modification: http://web.archive.org/web/20020603153925/srgb.com/usingsrgb.html Please use the proposed version stripping away this copyrighted binary profile, probably embedded by an image software at one time: exiftool -icc_profile"-<=" phpBB/adm/images/phpbb_logo.png I’ve checked the resulting image and trust it is identical to the original. Some more background on the issue: https://lists.debian.org/debian-devel/2014/05/msg00339.html PHPBB3-12582 --- phpBB/adm/images/phpbb_logo.png | Bin 9313 -> 6662 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/phpBB/adm/images/phpbb_logo.png b/phpBB/adm/images/phpbb_logo.png index c3f9248ed79bb8e6ddaded8f136091ba9ac42051..2d76ef18cbf65083638dfde8b38ac835ac4ee3a2 100644 GIT binary patch delta 11 ScmaFp(PlEiV)JCKbCLibx&-3@ delta 2698 zcmV;53U&2{G~q~)IDZOHX+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQEpR8#2| zJ@?-9LQ9B%luK_?6$l_wLW_VDktQl32@pz%A)(n7QNa;KMFbnjpojyGj)066Q7jCK z3fKqaA)=0hqlk*i`{8?|Yu3E?=FR@K*FNX0^PRKL2fzpnmVZbyQ8j=JsX`tR;Dg7+ z#^K~HK!FM*Z~zbpvt%K2{UZSY_f59&ghTmgWD z0l;*TI7e|ZE3OddDgXd@nX){&BsoQaTL>+22Uk}v9w^R9 z7b_GtVFF>AKrX_0nHe&HG!NkO%m4tOkrff(gY*4(&VLTB&dxTDwhmt{>c0m6B4T3W z{^ifBa6kY6;dFk{{wy!E8h|?nfNlPwCGG@hUJIag_lst-4?wj5py}FI^KkfnJUm6A zkh$5}<>chpO2k52Vaiv1{%68pz*qfj`F=e7_x0eu;v|7GU4cgg_~63K^h~83&yop* zV%+ABM}Pdc3;+Bb(;~!4V!2o<6ys46agIcqjPo+3B8fthDa9qy|77CdEc*jK-!%ZR zYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S1Au6Q;m>#f??3%Vpd|o+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Uh4uDM)mx$b(swR>jw=^LIm&fWCA zdGQwi*43UlJ>9+YdT;l|_x0Zv-F|W>{m#p~*>@-It-MdXU-UrjLD@syht)q@{@mE_ z+<$7occAmp+(-8Yg@e!jk@b%cLj{kSkAKUC4TkHUI6gT!;y-fz>HMcd&t%Ugo)`Y2 z{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P`?ZJ24cOCDe z-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy001CkNK#Dz0D2_=0Dyx40I^8E E8LodFXaE2J From d7c143da24083d5b1fbf3ffa36846a3a071a02be Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 27 May 2014 20:51:48 +0200 Subject: [PATCH 6/7] [ticket/12582] Remove set -e due to exiftool not liking 0 byte files. PHPBB3-12582 --- phpBB/develop/strip_icc_profiles.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/develop/strip_icc_profiles.sh b/phpBB/develop/strip_icc_profiles.sh index 69431fbac2..d228448abe 100755 --- a/phpBB/develop/strip_icc_profiles.sh +++ b/phpBB/develop/strip_icc_profiles.sh @@ -3,7 +3,6 @@ # @copyright (c) 2014 phpBB Group # @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 # -set -e if [ "$#" -ne 1 ]; then SCRIPT=$(basename "$0") From de71837b711ec076e2bf9c3a4b2f6a5bc3c56030 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 27 May 2014 20:56:29 +0200 Subject: [PATCH 7/7] [ticket/12582] Fix coding style. PHPBB3-12582 --- phpBB/develop/strip_icc_profiles.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/develop/strip_icc_profiles.sh b/phpBB/develop/strip_icc_profiles.sh index d228448abe..779c7ffca7 100755 --- a/phpBB/develop/strip_icc_profiles.sh +++ b/phpBB/develop/strip_icc_profiles.sh @@ -4,7 +4,8 @@ # @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 # -if [ "$#" -ne 1 ]; then +if [ "$#" -ne 1 ] +then SCRIPT=$(basename "$0") echo "Description: Finds and strips ICC Profiles from given image file." >&2 echo "Usage: $SCRIPT /path/to/image/file" >&2