Fix: ctf: verify that field class is int before calling ctf_field_class_as_int
[babeltrace.git] / src / plugins / ctf / common / metadata / ctf-meta-resolve.cpp
index 5b65414ee6c3dffe0d837ba60448617c996ff5f1..fee1dda94a4a73d26bffcbb77f9fcfdf24288a85 100644 (file)
@@ -874,8 +874,6 @@ static int validate_target_field_path(struct ctf_field_path *target_field_path,
         break;
     case CTF_FIELD_CLASS_TYPE_SEQUENCE:
     {
-        struct ctf_field_class_int *int_fc = ctf_field_class_as_int(target_fc);
-
         if (target_fc->type != CTF_FIELD_CLASS_TYPE_INT &&
             target_fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
             _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(
@@ -886,6 +884,8 @@ static int validate_target_field_path(struct ctf_field_path *target_field_path,
             goto end;
         }
 
+        ctf_field_class_int *int_fc = ctf_field_class_as_int(target_fc);
+
         if (int_fc->is_signed) {
             _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(
                 "Sequence field class's length field class is not an unsigned integer field class: "
This page took 0.047781 seconds and 4 git commands to generate.