+
+ /* Validate content size and packet size values */
+ if (packet_index.content_size > packet_index.packet_size) {
+ fprintf(stdout, "[error] Content size (%zu bits) is larger than packet size (%zu bits).\n",
+ packet_index.content_size, packet_index.packet_size);
+ return -EINVAL;
+ }
+
+ if (packet_index.packet_size > filestats.st_size * CHAR_BIT) {
+ fprintf(stdout, "[error] Packet size (%zu bits) is larger than file size (%zu bits).\n",
+ packet_index.content_size, filestats.st_size * CHAR_BIT);
+ return -EINVAL;
+ }
+
+