29 Oct
2017
29 Oct
'17
9:18 a.m.
Hi Dennis,
I think the best fix would be to modify asnparse to automatically generate the SetConstraintBounds() into the generated code like in your original patch. But I'm not familiar with the code, so maybe you want to give it a go ?
For now I have committed this patch to Github.
Thanks!
Jan
--
Jan Willamowius, Founder of the GNU Gatekeeper Project
EMail : jan@willamowius.de
H.323 Support: https://www.willamowius.com/
Relaxed Communications GmbH
Frahmredder 91
22393 Hamburg
Geschäftsführer: Jan Willamowius
HRB 125261 (Amtsgericht Hamburg)
USt-IdNr: DE286003584
Denis Kochmashev wrote:
> Hi Jan,
>
> I am not talking about limitation of 128 items. It's also not good but it's
> not the case. I want to say that an instance of
> H225_ArrayOf_EnumeratedParameter without calling
> SetConstraintBounds(PASN_Object::FixedConstraint, 1, 512) on it will be
> incorrectly encoded. For example, the size of
> H225_ArrayOf_EnumeratedParameter with 5 EnumeratedParameters WITHOUT calling
> SetConstraintBounds will be 0x04, and if SetConstraintBounds was called will
> be 0x00 0x04. With size encoded as 0x04 decoders consider the packet
> malformed (attaching packet recordings).
>
> As a workaround SetConstraintBounds can be called on instance of
> H225_ArrayOf_EnumeratedParameter or inside any derived from
> H225_ArrayOf_EnumeratedParameter class (H460_FeatureTable). For
> H460_FeatureTable a call SetConstraintBounds can be made from constructor.
>
> --- h4601.cxx.orig 2014-06-26 11:32:04.000000000 +0600
> +++ h4601.cxx 2017-10-23 14:01:36.000000000 +0500
> @@ -505,11 +505,13 @@
>
> H460_FeatureTable::H460_FeatureTable()
> {
> + SetConstraintBounds(PASN_Object::FixedConstraint, 1, 512);
> SetSize(0);
> }
>
> H460_FeatureTable::H460_FeatureTable(const H225_ArrayOf_EnumeratedParameter
> & Xparams)
> {
> + SetConstraintBounds(PASN_Object::FixedConstraint, 1, 512);
> // OnReceivedPDU(Xparams);
> }
>
> But if someone will use H225_ArrayOf_EnumeratedParameter interface directly
> without calling SetConstraintBounds it will get malformed packets.
>
> -----Original Message-----
> From: h323plus [mailto:h323plus-bounces@lists.packetizer.com] On Behalf Of
> Jan Willamowius
> Sent: Monday, October 23, 2017 1:17 PM
> To: h323plus@lists.packetizer.com
> Subject: Re: [h323plus] Size constraints for
> H225_ArrayOf_EnumeratedParameter
>
> Hi Dennis,
>
> PTLib has a default limit of 128 items on enumerations, arrays etc.
> I have seen a similar limitation being hit with the number of aliases on
> registrations.
>
> Unfortunately we can't just insert that line into h225_2.cxx. That file is
> generated from the ASN.1 definition provided by the ITU (using asnparse).
> The change will be overwritten on the next import.
>
> There probably won'be many new versions coming, but can't you find a another
> place how we can set this ?
>
> Regards,
> Jan
>
> --
> Jan Willamowius, Founder of the GNU Gatekeeper Project EMail :
> jan@willamowius.de
> H.323 Support: https://www.willamowius.com/
>
> Relaxed Communications GmbH
> Frahmredder 91
> 22393 Hamburg
> Geschäftsführer: Jan Willamowius
> HRB 125261 (Amtsgericht Hamburg)
> USt-IdNr: DE286003584
>
>
> Denis Kochmashev wrote:
> > Hello!
> >
> >
> >
> > I have encountered something which looks like a bug. When I add
> > parameters to my custom H460_Feature via
> >
> > H460_FeatureTable table;
> >
> > :
> >
> > table.AddParameter(id, content);
> >
> > :
> >
> > SetCurrentTable(table);
> >
> >
> >
> > H323Plus produces malformed packet with incorrectly encoded size of
> > H225_ArrayOf_EnumeratedParameter. I've found that size constraints for
> > H225_ArrayOf_EnumeratedParameter are not beeing set, however,
> > according to spec, they had to be set. So, if my conclusion is right,
> > I propose a small patch like the following:
> >
> >
> >
> > --- h225_2.cxx.orig 2013-07-23 00:26:59.000000000 +0600
> >
> > +++ h225_2.cxx 2017-10-23 11:00:27.000000000 +0500
> >
> > @@ -19,6 +19,7 @@
> >
> > H225_ArrayOf_EnumeratedParameter::H225_ArrayOf_EnumeratedParameter(uns
> > igned
> > tag, PASN_Object::TagClass tagClass)
> >
> > : PASN_Array(tag, tagClass)
> >
> > {
> >
> > + SetConstraintBounds(PASN_Object::FixedConstraint, 1, 512);
> >
> > }
> >
> >
> >
> > Regards,
> >
> > Denis
> >
>
>