tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: libg++ (2.6.2) problem
@ 1995-02-07 22:23 gfkpci
  0 siblings, 0 replies; only message in thread
From: gfkpci @ 1995-02-07 22:23 UTC (permalink / raw)
  To: tru64-unix-managers


About 3 minutes after my posting, a super-nova exploded inside my head and
I figured out my problem.  For anyone building libg++ (version 2.6.2) on the
OSF/1 platform, you'll want to take notice of this solution.

In the file libio/iosscanf.c, look at the function header for the _IO_sscanf
function.  In the argument declaration for the NON-ANSI C case, the type of
the "string" argument is NOT defined.  As a result, the type defaults to
"int", which is 32-bits on the Alpha (and most other architectures).  Since
the Alpha is a 64-bit machine, the result is that any function calling
the _IO_sscanf function is likely to cause a segmentation violation due to
the truncation of the pointer to the "string" buffer.

In my file, the problem is on line 38.  Here's what the code WAS:

#ifdef __STDC__
  (const char * string, const char* format, ...)
#else
(string, format, va_alist) char *format; va_dcl
#endif

                           ^^^^^^^^^^^^^^^^^^^^
Note that there is no type declaration for the "string" argument.
Now, here's what the code SHOULD be:

#ifdef __STDC__
  (const char * string, const char* format, ...)
#else
(string, format, va_alist) char *string; char *format; va_dcl
#endif

Once I made this change, I just recompiled, rebuilt the library and
the test programs and all was well.

IF YOU MISS THIS FIX, ANYONE USING THE sscanf(3) FUNCTION IS LIKELY TO
RUN INTO PROBLEMS!  Caveat Emptor...  :-)

Hope this helps someone else out there...  :-)

-- Geordie

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-02-07 22:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-02-07 22:23 SUMMARY: libg++ (2.6.2) problem gfkpci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox