ayushtkn commented on code in PR #6581:
URL: https://github.com/apache/hive/pull/6581#discussion_r3618766594


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/esri/ST_GeomFromWKB.java:
##########
@@ -76,16 +74,12 @@ public BytesWritable evaluate(BytesWritable wkb) throws 
UDFArgumentException {
   public BytesWritable evaluate(BytesWritable wkb, int wkid) throws 
UDFArgumentException {
 
     try {
-      SpatialReference spatialReference = null;
+      byte[] byteArr = Arrays.copyOf(wkb.getBytes(), wkb.getLength());

Review Comment:
   You're right, removed from all seven WKB UDFs. I checked the JTS 1.20 
bytecode: WKBReader.read(byte[]) wraps the array in a `ByteArrayInStream` and 
reads sequentially, stopping once the geometry is complete, so trailing bytes 
past `getLength()` are never touched. The array length is only used as 
`maxCoordNum = bytes.length / 8`, a permissive sanity bound against malformed 
input claiming a huge point count; a larger backing array merely loosens that 
bound, it can't corrupt a valid parse.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to