[ 
https://issues.apache.org/jira/browse/HADOOP-4271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634390#action_12634390
 ] 

Raghu Angadi commented on HADOOP-4271:
--------------------------------------

Good catch. This can happen when {{seek()}} is used.  A few things:

- I think  (more) correct fix is to reset 'pos' and 'count' _before_ calling {{ 
readChecksumChunk()}}.. since once it is called, buffer is no longer valid (say 
there is some exception and user seeks again).

- You can generate 1500 bytes of random data in the test itself rather than 
requiring two extra files to be committed.

- Currently 'runTest()' fails only with checksum disabled. Same bug exists with 
checksum enabled as well, which is the common case. Can you change the test so 
that it fails with checksum enabled as well?

- There is already a {{TestFSInputChecksum.java}} in hdfs. Can you add this 
case there?

- Minor : using IOUtils.readFully() will reduce the code for the test. 

> Bug in FSInputChecker makes it possible to read from an invalid buffer
> ----------------------------------------------------------------------
>
>                 Key: HADOOP-4271
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4271
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: fs
>            Reporter: Ning Li
>            Priority: Minor
>         Attachments: .data_testFSInputChecker.crc, data_testFSInputChecker, 
> hadoop-4271.patch
>
>
> Bug in FSInputChecker makes it possible to read from an invalid buffer. The 
> buffer in FSInputChecker becomes invalid when readChecksumChunk is used to 
> read a chunk to a user buffer directly. Currently, it's not marked as invalid 
> in this case and may be read subsequently.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to