[84] in Kerberos-V5-bugs

home help back first fref pref prev next nref lref last post

Bug in pepy/posy 6.0

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Thu Dec 13 14:35:40 1990

Date: Thu, 13 Dec 90 14:35:11 EST
From: John T Kohl <jtkohl@ATHENA.MIT.EDU>
To: bug-isode@nisc.nyser.net
Cc: krb5-bugs@ATHENA.MIT.EDU

The enclosed ASN.1 definition file generates faulty code and C
structures which do not properly allow for initialization or
encoding/decoding/freeing of multiple entries in the sequence of integers.

Command-line arguments to pepy/posy:

[{1}quicksilver:/tmp]
% /mit/isode/isode-6.0/@sys/bin/posy -f -h2 -a -s -o FOO-types.py FOO-asn.py
posy 6.0 #5 (quicksilver) of Fri Sep 14 16:46:35 EDT 1990
[{1}quicksilver:/tmp]
% /mit/isode/isode-6.0/@sys/bin/pepy -a PY_advise -s -r FOO-types.py
pepy 6.0 #2 (quicksilver) of Fri Apr 27 10:42:36 EDT 1990
line 53: Warning: Can't find file UNIV.ph failed

last token read was "END"

Attached is a shar of the files which demonstrate the problem.
FOO-asn.py is the ASN.1 definition file; the others are generated
code/header files.
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  FOO-asn.py FOO-types.c FOO-types.h FOO-types.py FOO.ph
# Wrapped by jtkohl@quicksilver on Thu Dec 13 14:33:50 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'FOO-asn.py' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'FOO-asn.py'\"
else
echo shar: Extracting \"'FOO-asn.py'\" \(60 characters\)
sed "s/^X//" >'FOO-asn.py' <<'END_OF_FILE'
XFOO DEFINITIONS ::=
XBEGIN
X
XBar ::= SEQUENCE OF INTEGER
X
XEND
END_OF_FILE
if test 60 -ne `wc -c <'FOO-asn.py'`; then
    echo shar: \"'FOO-asn.py'\" unpacked with wrong size!
fi
# end of 'FOO-asn.py'
fi
if test -f 'FOO-types.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'FOO-types.c'\"
else
echo shar: Extracting \"'FOO-types.c'\" \(3924 characters\)
sed "s/^X//" >'FOO-types.c' <<'END_OF_FILE'
X/* automatically generated by pepy 6.0 #2 (quicksilver), do not edit! */
X
X#include <isode/psap.h>
X
Xstatic char *pepyid = "pepy 6.0 #2 (quicksilver) of Fri Apr 27 10:42:36 EDT 1990";
X
X#define	advise	PY_advise
X
Xvoid	advise ();
X
X/* Generated from module FOO */
X# line 5 "FOO-types.py"
X
X#include <stdio.h>
X#include "FOO-types.h"
X
X#ifndef PEPYPARM
X#define PEPYPARM char *
X#endif /* PEPYPARM */
Xextern PEPYPARM NullParm;
X
X/* ARGSUSED */
X
Xint	encode_FOO_Bar (pe, explicit, len, buffer, parm)
Xregister PE     *pe;
Xint	explicit;
Xinteger	len;
Xchar   *buffer;
Xstruct type_FOO_Bar * parm;
X{
X# line 18 "FOO-types.py"
X    
X	int     n_parm = 0;
X    
X    PE	p0 = NULLPE;
X    PE	p1_z = NULLPE;
X    register PE *p1 = &p1_z;
X
X    if (((*pe) = pe_alloc (PE_CLASS_UNIV, PE_FORM_CONS, PE_CONS_SEQ)) == NULLPE) {
X        advise (NULLCP, "Bar: %s", PEPY_ERR_NOMEM);
X        return NOTOK;
X    }
X    for (n_parm = 0; n_parm < parm -> nelem; n_parm++) {
X        register integer p2 = parm -> element_FOO_0 ;
X
X        if (((*p1) = num2prim (p2, PE_CLASS_UNIV, PE_PRIM_INT)) == NULLPE) {
X            advise (NULLCP, "element: %s", PEPY_ERR_NOMEM);
X            return NOTOK;
X        }
X
X#ifdef DEBUG
X        (void) testdebug ((*p1), "element");
X#endif
X
X        seq_addon ((*pe), p0, (*p1));
X        p0 = (*p1);
X    }
X
X#ifdef DEBUG
X    (void) testdebug ((*pe), "FOO.Bar");
X#endif
X
X
X    return OK;
X}
X
X/* ARGSUSED */
X
Xint	decode_FOO_Bar (pe, explicit, len, buffer, parm)
Xregister PE	pe;
Xint	explicit;
Xinteger    *len;
Xchar  **buffer;
Xstruct type_FOO_Bar ** parm;
X{
X# line 30 "FOO-types.py"
X    
X	int     n_parm = 0;
X    
X    register PE p3;
X
X#ifdef DEBUG
X    (void) testdebug (pe, "FOO.Bar");
X#endif
X
X    if (explicit) {
X        if (pe -> pe_class != PE_CLASS_UNIV
X                || pe -> pe_form != PE_FORM_CONS
X                || pe -> pe_id != PE_CONS_SEQ) {
X            advise (NULLCP, "Bar bad class/form/id: %s/%d/0x%x",
X                    pe_classlist[pe -> pe_class], pe -> pe_form, pe -> pe_id);
X            return NOTOK;
X        }
X    }
X    else
X        if (pe -> pe_form != PE_FORM_CONS) {
X            advise (NULLCP, "Bar bad form: %d", pe -> pe_form);
X            return NOTOK;
X        }
X
X    {
X# line 34 "FOO-types.py"
X
X        {
X            PE      xx_pe = prim2seq (pe);
X
X            n_parm = xx_pe -> pe_cardinal > 0 ? xx_pe -> pe_cardinal : 0;
X        }
X        if ((*(parm) = (struct type_FOO_Bar *)
X                calloc (1 + (unsigned) n_parm, sizeof **(parm))) == ((struct type_FOO_Bar *) 0)) {
X            advise (NULLCP, "%s", PEPY_ERR_NOMEM);
X            return NOTOK;
X        }
X        (*parm) -> nelem = n_parm;
X        n_parm = 0;
X    
X    }
X    if ((p3 = prim2seq (pe)) == NULLPE) {
X        advise (NULLCP, "Bar %s%s", PEPY_ERR_BAD_SEQ,
X                pe_error (pe -> pe_errno));
X        return NOTOK;
X    }
X    pe = p3;
X
X    for (p3 = first_member (pe); p3; p3 = next_member (pe, p3)) {
X        register integer p4;
X
X#ifdef DEBUG
X        (void) testdebug (p3, "element");
X#endif
X
X        if (p3 -> pe_class != PE_CLASS_UNIV
X                || p3 -> pe_form != PE_FORM_PRIM
X                || p3 -> pe_id != PE_PRIM_INT) {
X            advise (NULLCP, "element bad class/form/id: %s/%d/0x%x",
X                    pe_classlist[p3 -> pe_class], p3 -> pe_form, p3 -> pe_id);
X            return NOTOK;
X        }
X
X        if ((p4 = prim2num (p3)) == NOTOK
X                && p3 -> pe_errno != PE_ERR_NONE) {
X            advise (NULLCP, "element %s%s", PEPY_ERR_BAD_INTEGER,
X                    pe_error (p3 -> pe_errno));
X            return NOTOK;
X        }
X        (*parm) -> element_FOO_0  = p4;
X        {
X# line 51 "FOO-types.py"
X n_parm++; 
X        }
X    }
X
X    return OK;
X}
X# line 55 "FOO-types.py"
X
X
Xfree_FOO_Bar (arg)
Xstruct type_FOO_Bar *arg;
X{
X    struct type_FOO_Bar *parm = arg;
X    int	n_parm;
X
X    if (parm == NULL)
X	return;
X
X    for (n_parm = 0;
X            n_parm < parm -> nelem;
X            n_parm++) {
X
X    }
X
X}
X
END_OF_FILE
if test 3924 -ne `wc -c <'FOO-types.c'`; then
    echo shar: \"'FOO-types.c'\" unpacked with wrong size!
fi
# end of 'FOO-types.c'
fi
if test -f 'FOO-types.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'FOO-types.h'\"
else
echo shar: Extracting \"'FOO-types.h'\" \(369 characters\)
sed "s/^X//" >'FOO-types.h' <<'END_OF_FILE'
X/* automatically generated by posy 6.0 #5 (quicksilver), do not edit! */
X
X#ifndef	_module_FOO_defined_
X#define	_module_FOO_defined_
X
X#include <isode/psap.h>
X#include <isode/pepy/UNIV-types.h>
X
X
X
X                /* SEQUENCE OF */
Xstruct type_FOO_Bar {
X    int	nelem;
X                        /* INTEGER */
X        integer    element_FOO_0;
X};
Xint	free_FOO_Bar ();
X#endif
END_OF_FILE
if test 369 -ne `wc -c <'FOO-types.h'`; then
    echo shar: \"'FOO-types.h'\" unpacked with wrong size!
fi
# end of 'FOO-types.h'
fi
if test -f 'FOO-types.py' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'FOO-types.py'\"
else
echo shar: Extracting \"'FOO-types.py'\" \(1295 characters\)
sed "s/^X//" >'FOO-types.py' <<'END_OF_FILE'
X-- automatically generated by posy 6.0 #5 (quicksilver), do not edit!
X
XFOO DEFINITIONS ::=
X
X%{
X#include <stdio.h>
X#include "FOO-types.h"
X%}
X
XPREFIXES encode decode print
X
XBEGIN
X
X
XENCODER encode
X
XBar [[P struct type_FOO_Bar *]]
X    %{
X	int     n_parm = 0;
X    %}
X    ::=
X        SEQUENCE OF
X            <<n_parm = 0; n_parm < parm -> nelem; n_parm++>>
X            INTEGER
X            [[i parm -> element_FOO_0 ]]
X
XDECODER decode
X
XBar [[P struct type_FOO_Bar **]]
X    %{
X	int     n_parm = 0;
X    %}
X    ::=
X    %{
X        {
X            PE      xx_pe = prim2seq ($$);
X
X            n_parm = xx_pe -> pe_cardinal > 0 ? xx_pe -> pe_cardinal : 0;
X        }
X        if ((*(parm) = (struct type_FOO_Bar *)
X                calloc (1 + (unsigned) n_parm, sizeof **(parm))) == ((struct type_FOO_Bar *) 0)) {
X            advise (NULLCP, "%s", PEPY_ERR_NOMEM);
X            return NOTOK;
X        }
X        (*parm) -> nelem = n_parm;
X        n_parm = 0;
X    %}
X        SEQUENCE OF
X            INTEGER
X            [[i (*parm) -> element_FOO_0 ]]
X            %{ n_parm++; %}
X
XEND
X
X%{
X
Xfree_FOO_Bar (arg)
Xstruct type_FOO_Bar *arg;
X{
X    struct type_FOO_Bar *parm = arg;
X    int	n_parm;
X
X    if (parm == NULL)
X	return;
X
X    for (n_parm = 0;
X            n_parm < parm -> nelem;
X            n_parm++) {
X
X    }
X
X}
X
X%}
END_OF_FILE
if test 1295 -ne `wc -c <'FOO-types.py'`; then
    echo shar: \"'FOO-types.py'\" unpacked with wrong size!
fi
# end of 'FOO-types.py'
fi
if test -f 'FOO.ph' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'FOO.ph'\"
else
echo shar: Extracting \"'FOO.ph'\" \(66 characters\)
sed "s/^X//" >'FOO.ph' <<'END_OF_FILE'
X0/16/2: Bar |encode decode print
X0/16/1: Bar |encode decode print
END_OF_FILE
if test 66 -ne `wc -c <'FOO.ph'`; then
    echo shar: \"'FOO.ph'\" unpacked with wrong size!
fi
# end of 'FOO.ph'
fi
echo shar: End of shell archive.
exit 0

home help back first fref pref prev next nref lref last post