Closed Bug 307293 Opened 17 years ago Closed 17 years ago

Tag and type members of nsNSSASN1Sequence/nsNSSASN1PrintableItem remain uninitialized


(Core :: Security: PSM, defect)

Not set





(Reporter: sfraser_bugs, Assigned: KaiE)


(Keywords: fixed1.8)


(1 file)

nsNSSASN1Sequence and nsNSSASN1PrintableItem do not initialize their mType and
mTag member variables, so later calls to GetType() and GetTag() return garbage.

For some reason these are not being filled in when the objects are created.
Flags: blocking1.8b5?
It seems that the nsNSSCertificate::CreateASN1Struct() code path does not
initialize the tag and type fields.
Attached patch PatchSplinter Review
Attachment #195094 - Flags: superreview?(rrelyea)
Attachment #195094 - Flags: review?(wtchang)
Comment on attachment 195094 [details] [diff] [review]

I can't say if 0 is the right initial value for
mType and mTag.  But I verified that this patch
is correct C++ code and it does no harm.

0 is an invalid value for mTag (valid values are
0x01 - 0x1f).  For mType, 0 either means ASN1_END_CONTENTS
or is invalid.	So this patch replaces random garbage
by fixed garbage, which is an improvement.
Attachment #195094 - Flags: review?(wtchang) → review+
Attachment #195094 - Flags: superreview?(rrelyea) → superreview+
The mType and mTag members are set by the
buildASN1ObjectFromDER static function in
which is only called by CreateFromDER,
but no code calls CreateFromDER.

If no code (other than the constructors after the
proposed patch is applied) sets the mTag and mType
members, then we shouldn't call the GetType and
GetTag methods either.

So one can also view the mTag and mType members
as dead code and they should be removed along with
the CreateFromDER and buildASN1ObjectFromDER functions,
and the GetType, SetType, GetTag, SetTag methods.
Simon, can you describe the user impact and the risk in taking this patch?
As far as I know, there is no user impact, as I think no-one is using the
accessors for those uninitialized fields. This is simply a "correctness" fix.
Attachment #195094 - Flags: approval1.8b5+
Fixed on trunk and branch.
Closed: 17 years ago
Flags: blocking1.8b5?
Keywords: fixed1.8
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.