[PHP-DEV] CVS update: php3/functions From: thies (php-dev <email protected>)
Date: 12/14/98

Date: Monday December 14, 1998 @ 14:14
Author: thies

Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv12883/functions

Modified Files:
        iptc.c
Log Message:
break if the parser runs against invalid IPTC.

Index: php3/functions/iptc.c
diff -c php3/functions/iptc.c:1.3 php3/functions/iptc.c:1.4
*** php3/functions/iptc.c:1.3 Fri Dec 11 02:25:42 1998
--- php3/functions/iptc.c Mon Dec 14 14:14:57 1998
***************
*** 27,33 ****
     +----------------------------------------------------------------------+
   */
  
! /* $Id: iptc.c,v 1.3 1998/12/11 07:25:42 thies Exp $ */
  
  /*
   * Functions to parse & compse IPTC data.
--- 27,33 ----
     +----------------------------------------------------------------------+
   */
  
! /* $Id: iptc.c,v 1.4 1998/12/14 19:14:57 thies Exp $ */
  
  /*
   * Functions to parse & compse IPTC data.
***************
*** 47,53 ****
  
  void php3_iptcparse(INTERNAL_FUNCTION_PARAMETERS)
  {
! int length,inx, len;
          unsigned char *buffer;
          unsigned char recnum, dataset;
          unsigned char key[ 16 ];
--- 47,53 ----
  
  void php3_iptcparse(INTERNAL_FUNCTION_PARAMETERS)
  {
! unsigned int length,inx,len,inheader;
          unsigned char *buffer;
          unsigned char recnum, dataset;
          unsigned char key[ 16 ];
***************
*** 67,77 ****
          length = str->value.str.len;
          buffer = str->value.str.val;
  
          while (inx < length) {
                  if (buffer[ inx++ ] != 0x1c) { /* skip all junk */
! continue;
                  }
!
                  if ((inx + 4) >= length)
                          break;
  
--- 67,85 ----
          length = str->value.str.len;
          buffer = str->value.str.val;
  
+ inheader = 0; /* have we already found the IPTC-Header??? */
+
          while (inx < length) {
                  if (buffer[ inx++ ] != 0x1c) { /* skip all junk */
! if (inheader) {
! break; /* we ran against some data which does not conform to IPTC - stop parsing! */
! } else {
! continue;
! }
! } else {
! inheader = 1;
                  }
!
                  if ((inx + 4) >= length)
                          break;
  
***************
*** 86,92 ****
                          len = (((unsigned short) buffer[ inx ])<<8) | (unsigned short)buffer[ inx+1 ];
                          inx += 2;
                  }
-
  
                  sprintf(key,"%d#%03d",(unsigned int) dataset,(unsigned int) recnum);
  
--- 94,99 ----

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>