VenuReddy2103 commented on a change in pull request #3865:
URL: https://github.com/apache/carbondata/pull/3865#discussion_r474466612



##########
File path: 
streaming/src/main/scala/org/apache/carbondata/streaming/parser/FieldConverter.scala
##########
@@ -54,11 +54,12 @@ object FieldConverter {
       value match {
         case s: String => if (!isVarcharType && !isComplexType &&
                               s.length > 
CarbonCommonConstants.MAX_CHARS_PER_COLUMN_DEFAULT) {
-          throw new IllegalArgumentException(stringLengthExceedErrorMsg +
-            CarbonCommonConstants.MAX_CHARS_PER_COLUMN_DEFAULT + " characters")
-        } else {
-          s
+          if (!CarbonProperties.getInstance.getProperty(CarbonCommonConstants
+            .CARBON_ENABLE_BAD_RECORD_HANDLING_FOR_INSERT).toBoolean) {
+            throw new 
IllegalArgumentException(CarbonCommonConstants.STRING_LENGTH_EXCEEDED_MESSAGE)

Review comment:
       `STRING_LENGTH_EXCEEDED_MESSAGE` has format specifiers("%s") in it. It 
is directly passed `IllegalArgumentException` without formatting. Can cause 
security vulnerability issue. Also suggest to add FMT prefix to 
`STRING_LENGTH_EXCEEDED_MESSAGE` so that we don't miss such issues.
   
   `public static final String STRING_LENGTH_EXCEEDED_MESSAGE =
         "Record %s of column %s exceeded " + MAX_CHARS_PER_COLUMN_DEFAULT +
             " characters. Please consider long string data type.";`
   




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

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


Reply via email to