ctf: assert that request_sz in medium ops request_bytes is greater than 0
[babeltrace.git] / src / plugins / ctf / common / msg-iter / msg-iter.c
index a074aafe1814ec0ba948976d04bdf8d50894371b..9edc55c80b77b3c96264625c17d8a83c1c8be81e 100644 (file)
@@ -2837,6 +2837,8 @@ struct ctf_msg_iter *ctf_msg_iter_create(
        BT_ASSERT(tc);
        BT_ASSERT(medops.request_bytes);
        BT_ASSERT(medops.borrow_stream);
+       BT_ASSERT(max_request_sz > 0);
+
        BT_COMP_LOG_CUR_LVL(BT_LOG_DEBUG, log_level, self_comp,
                "Creating CTF plugin message iterator: "
                "trace-addr=%p, max-request-size=%zu, "
@@ -3160,23 +3162,11 @@ enum ctf_msg_iter_status ctf_msg_iter_seek(struct ctf_msg_iter *msg_it,
                off_t offset)
 {
        enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
-       bt_self_component *self_comp = msg_it->self_comp;
        enum ctf_msg_iter_medium_status medium_status;
 
        BT_ASSERT(msg_it);
-       if (offset < 0) {
-               BT_COMP_LOGE_APPEND_CAUSE(self_comp,
-                       "Cannot seek to negative offset: offset=%jd",
-                       (intmax_t) offset);
-               status = CTF_MSG_ITER_STATUS_INVAL;
-               goto end;
-       }
-
-       if (!msg_it->medium.medops.seek) {
-               status = CTF_MSG_ITER_STATUS_UNSUPPORTED;
-               BT_COMP_LOGD("Aborting seek as the iterator's underlying media does not implement seek support.");
-               goto end;
-       }
+       BT_ASSERT(offset >= 0);
+       BT_ASSERT(msg_it->medium.medops.seek);
 
        medium_status = msg_it->medium.medops.seek(offset, msg_it->medium.data);
        if (medium_status != CTF_MSG_ITER_MEDIUM_STATUS_OK) {
This page took 0.024796 seconds and 4 git commands to generate.