www.delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/2000/01/10/13:12:55

Sender: juan AT delorie DOT com
Message-ID: <3879F657.93592E00@altmayer.com>
Date: Mon, 10 Jan 2000 16:10:15 +0100
From: Juan Altmayer Pizzorno <juan AT altmayer DOT com>
X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.14 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: pgcc AT delorie DOT com
CC: jc AT port25 DOT com
Subject: Possible bug
Reply-To: pgcc AT delorie DOT com

This is a multi-part message in MIME format.
--------------07D2BC129B3A5AFDC7A73305
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

the attached file was "factored out" of a program that, among other
things, does DNS queries.  The code between the printf()'s seems to
affect the value of variable 'p', even though it shouldn't...  When
compiled with -O0 or no -O flags, it runs correctly.  But when compiled
with -O1 and above, it does not.  I've tried it with several different
versions of the compiler (egcs 2.91.66 from plain RedHat, egcs 2.95.2
from the official release, and pgcc 2.95.3 with the pgcc-2_95_3 tag
out of your CVS), all with identical results.  BTW pgcc-2_95_3 still
identifies itself as 2.95.2...  The second attachment is "t.E", obtained
with g++ -E t.cxx > t.E.  This is all on a Pentium II, RedHat 6.1,
kernel 2.2.14-based notebook.  Thanks

.. Juan

$ g++ --version
pgcc-2.95.2
$ g++ -O1 -o t t.cxx
$ ./t
2 p=BFFFFA92, p=BFFFFA92
2 p=BFFFFAAC, p=BFFFFAAC
2 p=BFFFFAAE, p=BFFFFAAE
2 p=BFFFFAC3, p=BFFFFAC3
2 p=BFFFFAAC, p=BFFFFA80   <--- should have been identical
2 p=BFFFFA82, p=C0002FE2   <--- should have been identical
--------------07D2BC129B3A5AFDC7A73305
Content-Type: text/plain; charset=us-ascii;
 name="t.cxx"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="t.cxx"

// $Id: t.cxx,v 1.12 2000/01/10 13:31:34 juan Exp $

/*
$ g++ --version
pgcc-2.95.2
$ g++ -O1 -o t t.cxx
$ ./t
2 p=BFFFFA92, p=BFFFFA92
2 p=BFFFFAAC, p=BFFFFAAC
2 p=BFFFFAAE, p=BFFFFAAE
2 p=BFFFFAC3, p=BFFFFAC3
2 p=BFFFFAAC, p=BFFFFA80   <---
2 p=BFFFFA82, p=C0002FE2   <---
*/

#include <stdio.h>
typedef unsigned char uchar;

static int
ExtractName (uchar* header, uchar*& p, uchar* end)
{
//printf ("1 p=%X\n", p);
    if (p >= end)
        return 1;

    register unsigned length;

    while ((length = *p++))
    {
        if (length & 0xc0)
        {
            uchar* jump;

            // compute offset in 'length', new 'p' in 'jump'
            length = ((length & 0x3F) << 8) | *p;

printf ("2 p=%X, ", p);

            jump = header + length;

printf ("p=%X\n", p);

            // advance 'p' to final position
            ++p;

            return ExtractName (header, jump, end);
        }
        else
        {
            if (p + length > end)
                return 1;

            p += length;
        }
    }

//printf ("3 p=%X\n", p);
    if (p > end)
        return 1;

    return 0;
}

int
main (int argc, char* argv[])
{
    uchar buffer[] = {
        0x00,0x01,0x81,0x80,0x00,0x01,0x00,0x02,0x00,0x04,0x00,0x06,0x08,0x75,0x6E,0x69,
        0x2D,0x62,0x6F,0x6E,0x6E,0x02,0x64,0x65,0x00,0x00,0x0F,0x00,0x01,0xC0,0x0C,0x00,
        0x0F,0x00,0x01,0x00,0x00,0x03,0x84,0x00,0x10,0x00,0x0A,0x06,0x6E,0x6F,0x64,0x65,
        0x30,0x33,0x04,0x72,0x68,0x72,0x7A,0xC0,0x0C,0xC0,0x0C,0x00,0x0F,0x00,0x01,0x00,
        0x00,0x03,0x84,0x00,0x0B,0x00,0x14,0x06,0x6E,0x6F,0x64,0x65,0x30,0x35,0xC0,0x32,
        0xC0,0x0C,0x00,0x02,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x06,0x03,0x4E,0x49,0x43,
        0xC0,0x32,0xC0,0x0C,0x00,0x02,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x0D,0x0A,0x6E,
        0x6F,0x64,0x65,0x30,0x33,0x2D,0x65,0x6E,0x32,0xC0,0x32,0xC0,0x0C,0x00,0x02,0x00,
        0x01,0x00,0x01,0x51,0x80,0x00,0x09,0x06,0x6E,0x6F,0x64,0x65,0x30,0x38,0xC0,0x32,
        0xC0,0x0C,0x00,0x02,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x17,0x07,0x77,0x73,0x2D,
        0x6D,0x75,0x65,0x31,0x06,0x77,0x69,0x6E,0x2D,0x69,0x70,0x03,0x64,0x66,0x6E,0x02,
        0x64,0x65,0x00,0xC0,0x2B,0x00,0x01,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x04,0x83,
        0xDC,0x12,0x85,0xC0,0x47,0x00,0x01,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x04,0x83,
        0xDC,0x12,0x87,0xC0,0x5C,0x00,0x01,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x04,0x83,
        0xDC,0x10,0xDC,0xC0,0x6E,0x00,0x01,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x04,0x83,
        0xDC,0x0E,0xCB,0xC0,0x87,0x00,0x01,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x04,0x83,
        0xDC,0x12,0x8A,0xC0,0x9C,0x00,0x01,0x00,0x01,0x00,0x00,0xF2,0x41,0x00,0x04,0xC1,
        0xAE,0x4B,0xA6
    };

    int rc;
    unsigned i;
    uchar* p = buffer;
    uchar* end = buffer + sizeof (buffer);

    // position at 1st answer
    p = buffer + 0x1D;

    // get owner
    if ((rc = ExtractName (buffer, p, end)))
        exit (1);

    // skip type(2), class(2), ttl(4), rdlength(2), MX preference(2)
    p += 2 + 2 + 4 + 2 + 2;

    // get mailer name
    if ((rc = ExtractName (buffer, p, end)))
        exit (1);

    // get owner
    if ((rc = ExtractName (buffer, p, end)))
        exit (1);

    // skip type(2), class(2), ttl(4), rdlength(2), MX preference(2)
    p += 2 + 2 + 4 + 2 + 2;

    // get mailer name
    if ((rc = ExtractName (buffer, p, end)))
        exit (1);

    return 0;
}

--------------07D2BC129B3A5AFDC7A73305
Content-Type: text/plain; charset=us-ascii;
 name="t.E"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="t.E"

# 1 "t.cxx"
 

 












# 1 "/usr/include/stdio.h" 1 3
 

















 







# 1 "/usr/include/features.h" 1 3
 




















 


























































 



















 





 



 







 
# 137 "/usr/include/features.h" 3


 









 





 



























# 195 "/usr/include/features.h" 3


































 



 








 




 

# 1 "/usr/include/sys/cdefs.h" 1 3
 




















 




 





 








 




# 71 "/usr/include/sys/cdefs.h" 3


 







 



# 103 "/usr/include/sys/cdefs.h" 3



 








 















 








 








 









 







# 249 "/usr/include/features.h" 2 3


 








 





 

 








# 1 "/usr/include/gnu/stubs.h" 1 3
 






































# 277 "/usr/include/features.h" 2 3




# 27 "/usr/include/stdio.h" 2 3


extern "C" { 



# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 1 3






 


# 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3



 


 





 


# 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3


 





 


















 





 

 

# 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3


 

 


































typedef unsigned int size_t;






















 




 

# 271 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3


# 283 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3


 

 

# 317 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3




 





















# 33 "/usr/include/stdio.h" 2 3





# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h" 1 3
 





























































 






typedef void *__gnuc_va_list;



 

# 116 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h" 3



















# 202 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h" 3




# 38 "/usr/include/stdio.h" 2 3


# 1 "/usr/include/bits/types.h" 1 3
 

















 









# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 1 3






 


# 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3



 


 





 


# 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3


 





 


















 





 

 

# 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3


 

 


# 188 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3





 




 

# 271 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3


# 283 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3


 

 

# 317 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3




 





















# 29 "/usr/include/bits/types.h" 2 3


 
typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;

__extension__ typedef unsigned long long int __u_quad_t;
__extension__ typedef long long int __quad_t;
# 48 "/usr/include/bits/types.h" 3

typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;

__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;

typedef __quad_t *__qaddr_t;

typedef __u_quad_t __dev_t;		 
typedef __u_int __uid_t;		 
typedef __u_int __gid_t;		 
typedef __u_long __ino_t;		 
typedef __u_int __mode_t;		 
typedef __u_int __nlink_t; 		 
typedef long int __off_t;		 
typedef __quad_t __loff_t;		 
typedef int __pid_t;			 
typedef int __ssize_t;			 
typedef long int __rlim_t;		 
typedef __quad_t __rlim64_t;		 
typedef __u_int __id_t;			 

typedef struct
  {
    int __val[2];
  } __fsid_t;				 

 
typedef int __daddr_t;			 
typedef char *__caddr_t;
typedef long int __time_t;
typedef long int __swblk_t;		 

typedef long int __clock_t;

 
typedef unsigned long int __fd_mask;

 


 




 
typedef struct
  {
     





    __fd_mask __fds_bits[1024  / (8 * sizeof (__fd_mask)) ];


  } __fd_set;


typedef int __key_t;

 
typedef unsigned short int __ipc_pid_t;


 

 
typedef long int __blkcnt_t;
typedef __quad_t __blkcnt64_t;

 
typedef __u_long __fsblkcnt_t;
typedef __u_quad_t __fsblkcnt64_t;

 
typedef __u_long __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;

 
typedef __u_long __ino64_t;

 
typedef __loff_t __off64_t;

 
typedef int __t_scalar_t;
typedef unsigned int __t_uscalar_t;

 
typedef int __intptr_t;


 





# 40 "/usr/include/stdio.h" 2 3







 
typedef struct _IO_FILE FILE;








# 1 "/usr/include/libio.h" 1 3
 




























# 1 "/usr/include/_G_config.h" 1 3
 





 






# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 1 3






 


# 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3



 


 





 


# 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3


 





 


















 





 

 

# 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3


 

 


# 188 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3





 




 





























 



















































typedef unsigned int  wint_t;




 

 

# 317 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3




 





















# 14 "/usr/include/_G_config.h" 2 3





















typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));




 


















 




 














# 30 "/usr/include/libio.h" 2 3
















 

# 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h" 1 3
 





























































 










 

# 116 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h" 3



















# 202 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h" 3




# 48 "/usr/include/libio.h" 2 3







# 67 "/usr/include/libio.h" 3


 

















# 98 "/usr/include/libio.h" 3











 
























 



















struct _IO_jump_t;  struct _IO_FILE;

 







typedef void _IO_lock_t;



 

struct _IO_marker {
  struct _IO_marker *_next;
  struct _IO_FILE *_sbuf;
   

   
  int _pos;
# 186 "/usr/include/libio.h" 3

};

struct _IO_FILE {
  int _flags;		 


   
   
  char* _IO_read_ptr;	 
  char* _IO_read_end;	 
  char* _IO_read_base;	 
  char* _IO_write_base;	 
  char* _IO_write_ptr;	 
  char* _IO_write_end;	 
  char* _IO_buf_base;	 
  char* _IO_buf_end;	 
   
  char *_IO_save_base;  
  char *_IO_backup_base;   
  char *_IO_save_end;  

  struct _IO_marker *_markers;

  struct _IO_FILE *_chain;

  int _fileno;
  int _blksize;
  __off_t   _old_offset;  


   
  unsigned short _cur_column;
  signed char _vtable_offset;
  char _shortbuf[1];

   

  _IO_lock_t *_lock;








  __off64_t   _offset;
   
  int _unused2[16];

};





struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_;











 

 

typedef __ssize_t __io_read_fn  (void *  __cookie, char *__buf,
				       size_t __nbytes)  ;

 





typedef __ssize_t __io_write_fn  (void *  __cookie, __const char *__buf,
				      size_t __n)  ;

 





typedef int __io_seek_fn  (void *  __cookie, __off_t   __pos, int __w)  ;

 
typedef int __io_close_fn  (void *  __cookie)  ;


# 311 "/usr/include/libio.h" 3




extern "C" {


extern int __underflow  (_IO_FILE *)  throw ()  ;
extern int __uflow  (_IO_FILE *)  throw ()  ;
extern int __overflow  (_IO_FILE *, int)  throw ()  ;
















extern int _IO_getc  (_IO_FILE *__fp)  throw ()  ;
extern int _IO_putc  (int __c, _IO_FILE *__fp)  throw ()  ;
extern int _IO_feof  (_IO_FILE *__fp)  throw ()  ;
extern int _IO_ferror  (_IO_FILE *__fp)  throw ()  ;

extern int _IO_peekc_locked  (_IO_FILE *__fp)  throw ()  ;

 



extern void _IO_flockfile  (_IO_FILE *)  throw ()  ;
extern void _IO_funlockfile  (_IO_FILE *)  throw ()  ;
extern int _IO_ftrylockfile  (_IO_FILE *)  throw ()  ;












extern int _IO_vfscanf  (_IO_FILE *  , const char *  ,
			     __gnuc_va_list , int *  )  throw ()  ;
extern int _IO_vfprintf  (_IO_FILE *  , const char *  ,
			      __gnuc_va_list )  throw ()  ;
extern __ssize_t   _IO_padn  (_IO_FILE *, int, __ssize_t  )  throw ()  ;
extern size_t   _IO_sgetn  (_IO_FILE *, void *, size_t  )  throw ()  ;

extern __off64_t   _IO_seekoff  (_IO_FILE *, __off64_t  , int, int)  throw ()  ;
extern __off64_t   _IO_seekpos  (_IO_FILE *, __off64_t  , int)  throw ()  ;

extern void _IO_free_backup_area  (_IO_FILE *)  throw ()  ;


}



# 57 "/usr/include/stdio.h" 2 3


 

typedef __off_t  fpos_t;







 





 





 






 







 




 








# 1 "/usr/include/bits/stdio_lim.h" 1 3
 




































# 110 "/usr/include/stdio.h" 2 3



 
extern FILE *stdin;		 
extern FILE *stdout;		 
extern FILE *stderr;		 


 
extern int remove  (__const char *__filename)  throw ()  ;
 
extern int rename  (__const char *__old, __const char *__new)  throw ()  ;


 

extern FILE *tmpfile  (void)  throw ()  ;










 
extern char *tmpnam  (char *__s)  throw ()  ;


 

extern char *tmpnam_r  (char *__s)  throw ()  ;




 






extern char *tempnam  (__const char *__dir, __const char *__pfx)  throw ()  ;



 
extern int fclose  (FILE *__stream)  throw ()  ;
 
extern int fflush  (FILE *__stream)  throw ()  ;


 
extern int fflush_unlocked  (FILE *__stream)  throw ()  ;









 
extern FILE *fopen  (__const char *   __filename,
			 __const char *   __modes)  throw ()  ;
 
extern FILE *freopen  (__const char *   __filename,
			   __const char *   __modes,
			   FILE *   __stream)  throw ()  ;
# 197 "/usr/include/stdio.h" 3










 
extern FILE *fdopen  (int __fd, __const char *__modes)  throw ()  ;


# 223 "/usr/include/stdio.h" 3



 

extern void setbuf  (FILE *   __stream, char *   __buf)  throw ()  ;
 


extern int setvbuf  (FILE *   __stream, char *   __buf,
			 int __modes, size_t __n)  throw ()  ;


 

extern void setbuffer  (FILE *   __stream, char *   __buf,
			    size_t __size)  throw ()  ;

 
extern void setlinebuf  (FILE *__stream)  throw ()  ;



 
extern int fprintf  (FILE *   __stream,
			 __const char *   __format, ...)  throw ()  ;
 
extern int printf  (__const char *   __format, ...)  throw ()  ;
 
extern int sprintf  (char *   __s,
			 __const char *   __format, ...)  throw ()  ;

 
extern int vfprintf  (FILE *   __s,
			  __const char *   __format,
			  __gnuc_va_list  __arg)  throw ()  ;
 
extern int vprintf  (__const char *   __format,
			 __gnuc_va_list  __arg)  throw ()  ;
 
extern int vsprintf  (char *   __s,
			  __const char *   __format,
			  __gnuc_va_list  __arg)  throw ()  ;


 
extern int snprintf  (char *   __s, size_t __maxlen,
			  __const char *   __format, ...)  throw ()  
     __attribute__ ((__format__ (__printf__, 3, 4)));

extern int __vsnprintf  (char *   __s, size_t __maxlen,
			     __const char *   __format,
			     __gnuc_va_list  __arg)  throw ()  
     __attribute__ ((__format__ (__printf__, 3, 0)));
extern int vsnprintf  (char *   __s, size_t __maxlen,
			   __const char *   __format,
			   __gnuc_va_list  __arg)  throw ()  
     __attribute__ ((__format__ (__printf__, 3, 0)));


# 302 "/usr/include/stdio.h" 3



 
extern int fscanf  (FILE *   __stream,
			__const char *   __format, ...)  throw ()  ;
 
extern int scanf  (__const char *   __format, ...)  throw ()  ;
 
extern int sscanf  (__const char *   __s,
			__const char *   __format, ...)  throw ()  ;

# 330 "/usr/include/stdio.h" 3



 
extern int fgetc  (FILE *__stream)  throw ()  ;
extern int getc  (FILE *__stream)  throw ()  ;

 
extern int getchar  (void)  throw ()  ;

 




 
extern int getc_unlocked  (FILE *__stream)  throw ()  ;
extern int getchar_unlocked  (void)  throw ()  ;



 
extern int fgetc_unlocked  (FILE *__stream)  throw ()  ;



 
extern int fputc  (int __c, FILE *__stream)  throw ()  ;
extern int putc  (int __c, FILE *__stream)  throw ()  ;

 
extern int putchar  (int __c)  throw ()  ;

 




 
extern int fputc_unlocked  (int __c, FILE *__stream)  throw ()  ;



 
extern int putc_unlocked  (int __c, FILE *__stream)  throw ()  ;
extern int putchar_unlocked  (int __c)  throw ()  ;




 
extern int getw  (FILE *__stream)  throw ()  ;

 
extern int putw  (int __w, FILE *__stream)  throw ()  ;



 
extern char *fgets  (char *   __s, int __n,
			 FILE *   __stream)  throw ()  ;







 

extern char *gets  (char *__s)  throw ()  ;


# 420 "/usr/include/stdio.h" 3



 
extern int fputs  (__const char *   __s,
		       FILE *   __stream)  throw ()  ;







 
extern int puts  (__const char *__s)  throw ()  ;


 
extern int ungetc  (int __c, FILE *__stream)  throw ()  ;


 
extern size_t fread  (void *   __ptr, size_t __size,
			  size_t __n, FILE *   __stream)  throw ()  ;
 
extern size_t fwrite  (__const void *   __ptr, size_t __size,
			   size_t __n, FILE *   __s)  throw ()  ;


 
extern size_t fread_unlocked  (void *   __ptr, size_t __size,
				   size_t __n, FILE *   __stream)  throw ()  ;
extern size_t fwrite_unlocked  (__const void *   __ptr,
				    size_t __size, size_t __n,
				    FILE *   __stream)  throw ()  ;



 
extern int fseek  (FILE *__stream, long int __off, int __whence)  throw ()  ;
 
extern long int ftell  (FILE *__stream)  throw ()  ;
 
extern void rewind  (FILE *__stream)  throw ()  ;

 




 


typedef __off_t off_t;




















 
extern int fgetpos  (FILE *   __stream,
			 fpos_t *   __pos)  throw ()  ;
 
extern int fsetpos  (FILE *__stream, __const fpos_t *__pos)  throw ()  ;
# 519 "/usr/include/stdio.h" 3


# 529 "/usr/include/stdio.h" 3


 
extern void clearerr  (FILE *__stream)  throw ()  ;
 
extern int feof  (FILE *__stream)  throw ()  ;
 
extern int ferror  (FILE *__stream)  throw ()  ;


 
extern void clearerr_unlocked  (FILE *__stream)  throw ()  ;
extern int feof_unlocked  (FILE *__stream)  throw ()  ;
extern int ferror_unlocked  (FILE *__stream)  throw ()  ;



 
extern void perror  (__const char *__s)  throw ()  ;

 


extern int sys_nerr;
extern __const char *__const sys_errlist[];








 
extern int fileno  (FILE *__stream)  throw ()  ;



 
extern int fileno_unlocked  (FILE *__stream)  throw ()  ;





 
extern FILE *popen  (__const char *__command, __const char *__modes)  throw ()  ;

 
extern int pclose  (FILE *__stream)  throw ()  ;




 
extern char *ctermid  (char *__s)  throw ()  ;









# 603 "/usr/include/stdio.h" 3




 

 
extern void flockfile  (FILE *__stream)  throw ()  ;

 

extern int ftrylockfile  (FILE *__stream)  throw ()  ;

 
extern void funlockfile  (FILE *__stream)  throw ()  ;










 





} 




# 16 "t.cxx" 2

typedef unsigned char uchar;

static int
ExtractName (uchar* header, uchar*& p, uchar* end)
{
 
    if (p >= end)
        return 1;

    register unsigned length;

    while ((length = *p++))
    {
        if (length & 0xc0)
        {
            uchar* jump;

             
            length = ((length & 0x3F) << 8) | *p;

printf ("2 p=%X, ", p);

            jump = header + length;

printf ("p=%X\n", p);

             
            ++p;

            return ExtractName (header, jump, end);
        }
        else
        {
            if (p + length > end)
                return 1;

            p += length;
        }
    }

 
    if (p > end)
        return 1;

    return 0;
}

int
main (int argc, char* argv[])
{
    uchar buffer[] = {
        0x00,0x01,0x81,0x80,0x00,0x01,0x00,0x02,0x00,0x04,0x00,0x06,0x08,0x75,0x6E,0x69,
        0x2D,0x62,0x6F,0x6E,0x6E,0x02,0x64,0x65,0x00,0x00,0x0F,0x00,0x01,0xC0,0x0C,0x00,
        0x0F,0x00,0x01,0x00,0x00,0x03,0x84,0x00,0x10,0x00,0x0A,0x06,0x6E,0x6F,0x64,0x65,
        0x30,0x33,0x04,0x72,0x68,0x72,0x7A,0xC0,0x0C,0xC0,0x0C,0x00,0x0F,0x00,0x01,0x00,
        0x00,0x03,0x84,0x00,0x0B,0x00,0x14,0x06,0x6E,0x6F,0x64,0x65,0x30,0x35,0xC0,0x32,
        0xC0,0x0C,0x00,0x02,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x06,0x03,0x4E,0x49,0x43,
        0xC0,0x32,0xC0,0x0C,0x00,0x02,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x0D,0x0A,0x6E,
        0x6F,0x64,0x65,0x30,0x33,0x2D,0x65,0x6E,0x32,0xC0,0x32,0xC0,0x0C,0x00,0x02,0x00,
        0x01,0x00,0x01,0x51,0x80,0x00,0x09,0x06,0x6E,0x6F,0x64,0x65,0x30,0x38,0xC0,0x32,
        0xC0,0x0C,0x00,0x02,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x17,0x07,0x77,0x73,0x2D,
        0x6D,0x75,0x65,0x31,0x06,0x77,0x69,0x6E,0x2D,0x69,0x70,0x03,0x64,0x66,0x6E,0x02,
        0x64,0x65,0x00,0xC0,0x2B,0x00,0x01,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x04,0x83,
        0xDC,0x12,0x85,0xC0,0x47,0x00,0x01,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x04,0x83,
        0xDC,0x12,0x87,0xC0,0x5C,0x00,0x01,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x04,0x83,
        0xDC,0x10,0xDC,0xC0,0x6E,0x00,0x01,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x04,0x83,
        0xDC,0x0E,0xCB,0xC0,0x87,0x00,0x01,0x00,0x01,0x00,0x01,0x51,0x80,0x00,0x04,0x83,
        0xDC,0x12,0x8A,0xC0,0x9C,0x00,0x01,0x00,0x01,0x00,0x00,0xF2,0x41,0x00,0x04,0xC1,
        0xAE,0x4B,0xA6
    };

    int rc;
    unsigned i;
    uchar* p = buffer;
    uchar* end = buffer + sizeof (buffer);

     
    p = buffer + 0x1D;

     
    if ((rc = ExtractName (buffer, p, end)))
        exit (1);

     
    p += 2 + 2 + 4 + 2 + 2;

     
    if ((rc = ExtractName (buffer, p, end)))
        exit (1);

     
    if ((rc = ExtractName (buffer, p, end)))
        exit (1);

     
    p += 2 + 2 + 4 + 2 + 2;

     
    if ((rc = ExtractName (buffer, p, end)))
        exit (1);

    return 0;
}

--------------07D2BC129B3A5AFDC7A73305--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019