[ 
https://issues.apache.org/jira/browse/ARROW-1756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16239170#comment-16239170
 ] 

ASF GitHub Bot commented on ARROW-1756:
---------------------------------------

wesm commented on a change in pull request #1276: ARROW-1756: [Python] Fix 
large file read/write error
URL: https://github.com/apache/arrow/pull/1276#discussion_r148938919
 
 

 ##########
 File path: cpp/src/arrow/io/file.cc
 ##########
 @@ -238,39 +253,61 @@ static inline Status FileSeek(int fd, int64_t pos) {
   return Status::OK();
 }
 
-static inline Status FileRead(int fd, uint8_t* buffer, int64_t nbytes,
+static inline Status FileRead(const int fd, uint8_t* buffer, const int64_t 
nbytes,
                               int64_t* bytes_read) {
 #if defined(_MSC_VER)
-  if (nbytes > INT32_MAX) {
+  if (nbytes > ARROW_IO_MAX_CONUT) {
     return Status::IOError("Unable to read > 2GB blocks yet");
   }
   *bytes_read = static_cast<int64_t>(_read(fd, buffer, 
static_cast<uint32_t>(nbytes)));
 #else
-  *bytes_read = static_cast<int64_t>(read(fd, buffer, 
static_cast<size_t>(nbytes)));
+  *bytes_read = 0;
+
+  while (*bytes_read != -1 && *bytes_read < nbytes) {
+    int64_t i = std::min(static_cast<int64_t>(ARROW_IO_MAX_CONUT), nbytes - 
*bytes_read);
 
 Review comment:
   We should use descriptive variable names. I will fix

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> [Python] Observed int32 overflow in Feather write/read path
> -----------------------------------------------------------
>
>                 Key: ARROW-1756
>                 URL: https://issues.apache.org/jira/browse/ARROW-1756
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>            Reporter: Wes McKinney
>            Assignee: Licht Takeuchi
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.8.0
>
>
> See downstream report
> https://github.com/wesm/feather/issues/321



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to