Out of memory condition

paul palmer paulp at sonic.net
Thu Dec 28 20:25:06 CST 2000


To: Eric Eisenhart:

Eric:
   Thanks for the validation. I thought I was overlooking something obvious.
  Since you asked, I ran the okay script with a -V switch and got this:
==================================================

Summary of my perl5 (revision 5 version 6 subversion 0) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cl', optimize='-O1 -MD -DNDEBUG', gccversion=
    cppflags='-DWIN32'
    ccflags
='-O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_
IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='link', ldflags
'-nologo -nodefaultlib -release  -libpath:"E:\Perl\lib\CORE"  -machine:x86'
    libpth="E:\Perl\lib\CORE"
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib
msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ',
ddlflags='-dll -nologo -nodefaultlib -release  -libpath:"E:\Perl\lib\CORE"
-machine:x86'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEXT
PERL_IMPLICIT_SYS
  Locally applied patches:
   ActivePerl Build 615
  Built under MSWin32
  Compiled at Jul  4 2000 12:54:35
  @INC:
    E:/Program Files/Perl/Perl_programs/lib
    E:/Program Files/Perl/Perl_programs/site/lib
==================================================
I don't really know what -V does or what to think of the output. Then I
changed the quotes back to double ones and did the same thing.
====================================================
Summary of my perl5 (revision 5 version 6 subversion 0) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cl', optimize='-O1 -MD -DNDEBUG', gccversion=
    cppflags='-DWIN32'
    ccflags
='-O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_
IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='link', ldflags
'-nologo -nodefaultlib -release  -libpath:"E:\Perl\lib\CORE"  -machine:x86'
    libpth="E:\Perl\lib\CORE"
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib
msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ',
ddlflags='-dll -nologo -nodefaultlib -release  -libpath:"E:\Perl\lib\CORE"
-machine:x86'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEXT
PERL_IMPLICIT_SYS
  Locally applied patches:
   ActivePerl Build 615
  Built under MSWin32
  Compiled at Jul  4 2000 12:54:35
  @INC:
    E:/Program Files/Perl/Perl_programs/lib
    E:/Program Files/Perl/Perl_programs/site/lib
================================================
Then I changed the -V back to -w and reran it. I got:
==============================================
Out of memory!

I don't see the point of supplying the coding to parse_template because the
interpreter never got as far as execution. Do you see any way for the actual
construction of parse_template to affect the compilation phase as it did?
Nevertheless, here it is.
===================================================
sub parse_form {
    local($name, $value, $pair, $buffer, @pairs);

    # Check for request method and handle appropriately
#   THIS IS ALWAYS GET, NEVER POST, NO MATTER WHAT I PUT INTO <FORM ACTION

    if ($ENV{'REQUEST_METHOD'} eq 'GET') {
        @pairs = split(/&/, $ENV{'QUERY_STRING'});
            # get all the form data from QUERY_STRING
    }
    elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
        read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
        @pairs = split(/&/, $buffer);
             # get all the form data from the standard input
    }
    else {
        $Error_Message = "Bad request method ($ENV{'REQUEST_METHOD'}).  Use
POST or GET";
        return(0);
    }


    # Convert the data to its original format

    foreach $pair (@pairs) {
        ($name, $value) = split(/=/, $pair);     # Split each entry into a
name and a value,
                                                 #  delimited by an = sign.

        $name =~ tr/+/ /;         # translate - replace all + signs with
spaces
        $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
                                  # replace the % variables with their
equivalents (?)
        $name =~ s/\n//g;
                                  # remove all newlines
        $value =~ tr/+/ /;
                                  # translate - replace all + signs with
spaces
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
                                  # replace the % variables with their real
values
        $value =~ s/\n//g;
                                  # remove all newlines

        # If they try to include server side includes (scripts? -PP), erase
them, so they
        # aren't a security risk if the HTML gets returned.  Another
        # security hole plugged up.

        $value =~ s/<!--(.|\n)*-->//g;   # replace any html comments with
blanks, even if the
                                         # comment extends over several
lines. Is this to remove
                                         # any scripts, like Javascript,
included in comments?

        # Store name/value pair in %CONFIG if the corresponding entry is
        # defined. $CONFIG_INIT{$name} is just used to remember if an entry
        # was already placed into $CONFIG{$name}.

        if ($CONFIG{$name} && $CONFIG_INIT{$name}) {
            $CONFIG{$name} .= ",$value";
        }
        elsif (defined($CONFIG{$name})) {
            $CONFIG{$name} = $CONFIG_INIT{$name} = $value;
        }

        # Otherwise store in %FORM

        elsif ($FORM{$name}) {
            $FORM{$name} .= ",$value";
        }
        else {
            $FORM{$name} = $value;
        }
    }
    return(1);
}

1;

===============================================

Thanks,

Paul Palmer







More information about the Santa-rosa-pm mailing list