kpumuk commented on code in PR #3646:
URL: https://github.com/apache/thrift/pull/3646#discussion_r3617126812


##########
lib/rb/ext/memory_buffer.c:
##########
@@ -134,13 +134,14 @@ VALUE rb_thrift_memory_buffer_read_into_buffer(VALUE 
self, VALUE buffer_value, V
   index = FIX2INT(rb_ivar_get(self, index_ivar_id));
   while (i < size) {
     if (index >= RSTRING_LEN(buf)) {
+      rb_ivar_set(self, index_ivar_id, INT2FIX(index));
       rb_raise(rb_eEOFError, "Not enough bytes remain in memory buffer");
     }
-    char byte = RSTRING_PTR(buf)[index++];
-
     if (i >= RSTRING_LEN(buffer_value)) {
+      rb_ivar_set(self, index_ivar_id, INT2FIX(index));
       rb_raise(rb_eIndexError, "index %d out of string", i);
     }
+    char byte = RSTRING_PTR(buf)[index++];
     ((char*)RSTRING_PTR(buffer_value))[i] = byte;
     i++;

Review Comment:
   Fair, addressed



-- 
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