iemejia commented on code in PR #3864:
URL: https://github.com/apache/avro/pull/3864#discussion_r3565885628


##########
lang/perl/lib/Avro/BinaryDecoder.pm:
##########
@@ -220,8 +339,26 @@ sub skip_block {
     my $block_count = decode_long($class, undef, undef, $reader);
     while ($block_count) {
         if ($block_count < 0) {
-            $reader->seek($block_count, 0);
-            next;
+            # A negative count is followed by a long block size in bytes, which
+            # lets the whole block be skipped without decoding each item. Skip

Review Comment:
   Great catch — this was a genuine pre-existing bug. Fixed in fce9c6a85e: 
skip_block no longer shifts an implicit $class; it takes ($reader, 
$block_content) to match the plain-function call style used by 
skip_array/skip_map, and passes __PACKAGE__ to decode_long (which ignores its 
first argument). Previously $class captured the reader handle and $reader 
captured the coderef, so decode_long would call $coderef->read and die whenever 
an array/map field was skipped during projection. Added a test that skips 
writer array and map fields absent from the reader schema (it would have 
crashed on the old code).



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