* data types.
*/
da = fr_dict_attr_unknown_typed_afrom_num(ctx, parent, value, type);
- if (!da) goto oom;
+ if (!da) return -fr_dbuff_used(&work_dbuff);
}
vp = fr_pair_afrom_da(ctx, da);
if (!vp) {
- oom:
fr_strerror_const("Out of memory");
return -fr_dbuff_used(&work_dbuff);
}
};
fr_dict_attr_t const *da = NULL;
+ if (parent->flags.internal) {
+ fr_strerror_printf("Cannot create 'raw' attribute from internal parent '%s' of data type '%s'",
+ parent->name, fr_type_to_str(parent->type));
+ return NULL;
+ }
+
+ if (((parent->type == FR_TYPE_TLV) || (parent->type == FR_TYPE_VENDOR))) {
+ if ((uint64_t) num >= ((uint64_t) 1 << (8 * parent->flags.type_size))) {
+ fr_strerror_printf("Invalid attribute number '%u' - it must be no more than %u bits in size",
+ num, 8 * parent->flags.type_size);
+ return NULL;
+ }
+ }
+
switch (type) {
default:
fr_strerror_printf("Cannot allocate unknown attribute '%u' - invalid data type '%s'",
# From a fuzzer output
#
decode-pair 9f a1 1a 19 a1 82 00 da 00 00 03 ea a2 01 1a be 00 00 00 28 1b 70 a1 00 da 00 00 03 ea
-match Invalid cbor header - unexpected end of data
+match Invalid attribute number '430014976' - it must be no more than 8 bits in size
count
match 61