schema compile BUGFIX compiling derived decimal types with range
fraction-digits value was not correctly passed into the derived types,
which was causing segmentation faults.
@@ -2560,7 +2560,9 @@ lys_compile_type_(struct lysc_ctx *ctx, struct lysp_node *context_node_p, uint16
}
return LY_EVALID;
}
- } else if (type_p->fraction_digits) {
+ dec->fraction_digits = type_p->fraction_digits;
+ } else {
+ if (type_p->fraction_digits) {
/* fraction digits is prohibited in types not directly derived from built-in decimal64 */
if (tpdfname) {
LOGVAL(ctx->ctx, LY_VLOG_STR, ctx->path, LYVE_SYNTAX_YANG,
@@ -2574,7 +2576,8 @@ lys_compile_type_(struct lysc_ctx *ctx, struct lysp_node *context_node_p, uint16
}
return LY_EVALID;
}
- dec->fraction_digits = type_p->fraction_digits;
+ dec->fraction_digits = ((struct lysc_type_dec *)base)->fraction_digits;
+ }
/* RFC 7950 9.2.4 - range */
if (type_p->range) {
