kwenzh commented on code in PR #3635:
URL: https://github.com/apache/avro/pull/3635#discussion_r2734527450


##########
lang/c/src/encoding_binary.c:
##########
@@ -180,21 +182,30 @@ size_bytes(avro_writer_t writer, const char *bytes, const 
int64_t len)
 static int read_string(avro_reader_t reader, char **s, int64_t *len)
 {
        int64_t  str_len = 0;
+       int64_t  max_available = -1;
        int rval;
        check_prefix(rval, read_long(reader, &str_len),
                     "Cannot read string length: ");
        if (str_len < 0) {
                avro_set_error("Invalid string length: %" PRId64, str_len);
                return EINVAL;
        }
+    //  max := r.tail - r.head + 1; if max >= 0 && size > max
+       max_available = avro_max_read(reader);
+       if (max_available >= 0 && str_len > max_available) {
+           avro_set_error("mem io: String length %" PRId64 " is greater than 
available buffer size %" PRId64,

Review Comment:
   <img width="954" height="546" alt="image" 
src="https://github.com/user-attachments/assets/908d5ff5-6fb6-4f61-ac3b-dd5f1d6f2626";
 />
   
    see again?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to