-
Bug
-
Resolution: Fixed
-
P3
-
None
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8290102 | 20 | Jorn Vernee | P3 | Resolved | Fixed | b06 |
JDK-8291403 | 19.0.2 | Jorn Vernee | P3 | Resolved | Fixed | b01 |
JDK-8291246 | 19.0.1 | Jorn Vernee | P3 | Resolved | Fixed | b04 |
* Converts a Java string into a UTF-8 encoded, null-terminated C string, storing the result into a memory segment.
String s1 = String.valueOf("123”);
String s2 = new String(new char[]{0, 0, 0});
seg1 = session.allocateUtf8String(s1);
seg2 = session.allocateUtf8String(s2);
seg1.byteSize() == seg2.byteSize() == 4
From C point of view seg2 == “\0\0\0\0” isn’t C string it’s a string literal.A null-terminated byte string - is a sequence of zero or more characters followed by a byte with value zero
Also, potentially, it is place to get loss of data integrity
String s1 = new String(new char[]{'a', 'b', 0, 'd'});
segment = session.allocateUtf8String(s1);
String s2 = segment.getUtf8String(0);
s1 != s2
String s1 = String.valueOf("123”);
String s2 = new String(new char[]{0, 0, 0});
seg1 = session.allocateUtf8String(s1);
seg2 = session.allocateUtf8String(s2);
seg1.byteSize() == seg2.byteSize() == 4
From C point of view seg2 == “\0\0\0\0” isn’t C string it’s a string literal.A null-terminated byte string - is a sequence of zero or more characters followed by a byte with value zero
Also, potentially, it is place to get loss of data integrity
String s1 = new String(new char[]{'a', 'b', 0, 'd'});
segment = session.allocateUtf8String(s1);
String s2 = segment.getUtf8String(0);
s1 != s2
- backported by
-
JDK-8290102 SegmentAllocator::allocateUtf8String(String str) should be clarified for strings containing \0
-
- Resolved
-
-
JDK-8291246 SegmentAllocator::allocateUtf8String(String str) should be clarified for strings containing \0
-
- Resolved
-
-
JDK-8291403 SegmentAllocator::allocateUtf8String(String str) should be clarified for strings containing \0
-
- Resolved
-
- csr for
-
JDK-8289693 MemorySegment.allocateUtf8String(String str) should be clarified for strings containing \0
-
- Closed
-
(1 links to)