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

ASF subversion and git services commented on IMPALA-13870:
----------------------------------------------------------

Commit f7449b26477c6c7654ad9b7d03710332200f2a33 in impala's branch 
refs/heads/master from Arnab Karmakar
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=f7449b264 ]

IMPALA-13870: Add operator<< for StringVal to prevent unsafe ptr usage

StringVal buffers are not null-terminated, but manual string
construction from ptr/len is error-prone. This change adds a
length-safe stream operator that handles NULL values and
non-terminated buffers correctly.

The operator uses ostream::write(ptr, len) to ensure only len bytes
are printed, never relying on null termination.

Testing:
- Added unit tests including special cases for NULL, empty,
  non-terminated, and embedded-null cases

Change-Id: I2dd226d69fee428b5b38bdbf84dc73de4293c81b
Reviewed-on: http://gerrit.cloudera.org:8080/24474
Reviewed-by: Peter Rozsa <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Michael Smith <[email protected]>


> Add operator << support for StringVal
> -------------------------------------
>
>                 Key: IMPALA-13870
>                 URL: https://issues.apache.org/jira/browse/IMPALA-13870
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Backend
>            Reporter: Yida Wu
>            Assignee: Arnab Karmakar
>            Priority: Major
>             Fix For: Impala 5.0.0
>
>
> StringVal may not have a null terminator in its pointer, so its length must 
> be considered when using it. Relying only on the pointer can lead to 
> incorrect usage. Implementing the << operator for StringVal could help reduce 
> such errors.
> However, this may require incresing the minimum C++ standard for udf.h to 
> C++11 in Impala 5.



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