kpumuk commented on code in PR #3339: URL: https://github.com/apache/thrift/pull/3339#discussion_r2924025934
########## lib/rb/test/fuzz/fuzz_common.rb: ########## @@ -0,0 +1,95 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +$:.unshift File.expand_path('../../lib', __dir__) +$:.unshift File.expand_path('../../ext', __dir__) +require 'thrift' +$:.unshift File.dirname(__FILE__) + "/gen-rb" +require 'fuzz_test_constants' + +require 'coverage' +Coverage.start(branches: true) unless Coverage.respond_to?(:running?) && Coverage.running? +require 'ruzzy' +# Ruzzy.enable_branch_coverage_hooks + +def ignorable_fuzz_exception?(error) + return true if error.is_a?(Thrift::ProtocolException) || + error.is_a?(EOFError) || + error.is_a?(Encoding::UndefinedConversionError) + + [ Review Comment: These errors are defence mechanism against corrupted data, and are expected during fuzzing. Other languages do a broader "allowance", for example Python says ```py except Exception: # We expect various exceptions during fuzzing pass ``` I chose to be extremely specific in what we ignore, and listed the ones we raise from the Thrift library code. -- 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]
