Hi,
  Using the recent Fedora 18 release, I noticed this is not possible to
update a stock ASN1 object anymore. This is because const objects are
now stored in read-only storage.
 
The nid_objs[] table is such a const object, and a pointer to an entry
of this table can be returned by OBJ_nid2obj() as an ASN1_OBJECT *
value, without the const.
Thus it is not possible anymore to modify a stock object.
It is not possible either to duplicate it (for later update), since
OBJ_dup() does NOT duplicate static objects.
 
If this feature is intended to be supported, the nid_objs[] table should
not be a const.
Else the OBJ_nid2obj() result value should be a const (to detect
problems at compile time). Or maybe some info about this should be added
to the documentation.
 
As an example, please find a demo program in attachment: if executed on
a system that stores static const objects in read-only storage, you'll
get a segfault. Else the stock object short name is updated.
 
Thanks for your attention
 
Patrick

Attachment: nid2obj-bug.c
Description: Binary data

Reply via email to