[ 
https://issues.apache.org/jira/browse/HDFS-16667?focusedWorklogId=791850&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-791850
 ]

ASF GitHub Bot logged work on HDFS-16667:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Jul/22 05:33
            Start Date: 18/Jul/22 05:33
    Worklog Time Spent: 10m 
      Work Description: GauthamBanasandra opened a new pull request, #4576:
URL: https://github.com/apache/hadoop/pull/4576

   <!--
     Thanks for sending a pull request!
       1. If this is your first time, please read our contributor guidelines: 
https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute
       2. Make sure your PR title starts with JIRA issue id, e.g., 
'HADOOP-17799. Your PR title ...'.
   -->
   
   ### Description of PR
   Currently, a variable is used to specify the array size in uriparser2 -
   
https://github.com/apache/hadoop/blob/34e548cb62ed21c5bba7a82f5f1489ca6bdfb8c4/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/third_party/uriparser2/uriparser2/uriparser2.c#L71-L79
   
   This results in the following error on Windows -
   ```
   H:\hadoop-hdfs-project\hadoop-hdfs-native-client\src\out\build\x64-Debug\cl 
: command line warning D9025: overriding '/W4' with '/w' 
       uriparser2.c
   
H:\hadoop-hdfs-project\hadoop-hdfs-native-client\src\main\native\libhdfspp\third_party\uriparser2\uriparser2\uriparser2.c(74,23):
 error C2057: expected constant expression 
   
H:\hadoop-hdfs-project\hadoop-hdfs-native-client\src\main\native\libhdfspp\third_party\uriparser2\uriparser2\uriparser2.c(74,23):
 error C2466: cannot allocate an array of constant size 0 
   
H:\hadoop-hdfs-project\hadoop-hdfs-native-client\src\main\native\libhdfspp\third_party\uriparser2\uriparser2\uriparser2.c(74,24):
 error C2133: 'buffer': unknown size 
   ```
   
   I've used malloc to fix this.
   
   ### How was this patch tested?
   1. Tested this locally by building on my Windows system.
   2. Hadoop Jenkins CI validation.
   
   ### For code changes:
   
   - [x] Does the title or this PR starts with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   - [ ] Object storage: have the integration tests been executed and the 
endpoint declared according to the connector-specific documentation?
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files?
   
   




Issue Time Tracking
-------------------

            Worklog Id:     (was: 791850)
    Remaining Estimate: 0h
            Time Spent: 10m

> Use malloc for buffer allocation in uriparser2
> ----------------------------------------------
>
>                 Key: HDFS-16667
>                 URL: https://issues.apache.org/jira/browse/HDFS-16667
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: libhdfs++
>    Affects Versions: 3.4.0
>         Environment: Windows 10
>            Reporter: Gautham Banasandra
>            Assignee: Gautham Banasandra
>            Priority: Major
>              Labels: libhdfscpp
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, a variable is used to specify the array size in *uriparser2* -
> https://github.com/apache/hadoop/blob/34e548cb62ed21c5bba7a82f5f1489ca6bdfb8c4/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/third_party/uriparser2/uriparser2/uriparser2.c#L71-L79
> {code:cpp}
> static int parse_int(const char *first, const char *after_last) {
>       const int size = after_last - first;
>       if (size) {
>               char buffer[size + 1];
>               memcpyz(buffer, first, size);
>               return atoi(buffer);
>       }
>       return 0;
> }
> {code}
> This results in the following error on Windows -
> {code}
> H:\hadoop-hdfs-project\hadoop-hdfs-native-client\src\out\build\x64-Debug\cl : 
> command line warning D9025: overriding '/W4' with '/w' 
>     uriparser2.c
> H:\hadoop-hdfs-project\hadoop-hdfs-native-client\src\main\native\libhdfspp\third_party\uriparser2\uriparser2\uriparser2.c(74,23):
>  error C2057: expected constant expression 
> H:\hadoop-hdfs-project\hadoop-hdfs-native-client\src\main\native\libhdfspp\third_party\uriparser2\uriparser2\uriparser2.c(74,23):
>  error C2466: cannot allocate an array of constant size 0 
> H:\hadoop-hdfs-project\hadoop-hdfs-native-client\src\main\native\libhdfspp\third_party\uriparser2\uriparser2\uriparser2.c(74,24):
>  error C2133: 'buffer': unknown size 
> {code}
> Thus, we need to use malloc to fix this.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to