You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "wjones127 (via GitHub)" <gi...@apache.org> on 2023/03/28 01:53:47 UTC

[GitHub] [arrow-rs] wjones127 commented on a diff in pull request #3944: feat: enable metadata import/export through C data interface

wjones127 commented on code in PR #3944:
URL: https://github.com/apache/arrow-rs/pull/3944#discussion_r1149944758


##########
arrow-schema/src/ffi.rs:
##########
@@ -212,6 +257,55 @@ impl FFI_ArrowSchema {
     pub fn dictionary_ordered(&self) -> bool {
         self.flags & 0b00000001 != 0
     }
+
+    pub fn metadata(&self) -> Result<HashMap<String, String>, ArrowError> {
+        if self.metadata.is_null() {
+            Ok(HashMap::new())
+        } else {
+            let mut pos = 0;
+            let buffer: *const u8 = self.metadata as *const u8;

Review Comment:
   The one thing I can think of is we can verify the lengths are all >= 0. It doesn't guarantee we will detect buffer overflow but it will let us detect it some of the time :shrug:



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org