vishalcoc44 commented on code in PR #1025: URL: https://github.com/apache/poi/pull/1025#discussion_r2901577617
########## poi-fuzz/src/main/java/org/apache/poi/fuzz/WorkbookEvaluatorFuzzer.java: ########## @@ -0,0 +1,122 @@ +/* ==================================================================== + 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. +==================================================================== */ + +package org.apache.poi.fuzz; + +import com.code_intelligence.jazzer.api.FuzzedDataProvider; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.formula.EvaluationCell; +import org.apache.poi.ss.formula.FormulaParseException; +import org.apache.poi.ss.formula.WorkbookEvaluator; +import org.apache.poi.ss.formula.eval.NotImplementedException; +import org.apache.poi.ss.usermodel.FormulaError; +import org.apache.poi.util.RecordFormatException; + +/** + * Fuzz target for the Apache POI WorkbookEvaluator engine. + * <p> + * This fuzzer exercises the core formula evaluation pipeline by + * setting fuzz-generated formulas on a pre-populated workbook and + * evaluating them through the {@link WorkbookEvaluator}. A 20x20 data + * grid with mixed cell types (numbers, strings, booleans, errors) + * ensures that referential functions (SUM, VLOOKUP, INDEX, etc.) + * reach deep evaluation branches. + * <p> + * Used by Google's OSS-Fuzz for continuous security testing. + */ +public class WorkbookEvaluatorFuzzer { + private static HSSFWorkbook workbook; Review Comment: alright, i have refactord both the files to remove all static state ########## poi-fuzz/src/main/java/org/apache/poi/fuzz/WorkbookEvaluatorFuzzer.java: ########## @@ -0,0 +1,122 @@ +/* ==================================================================== + 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. +==================================================================== */ + +package org.apache.poi.fuzz; + +import com.code_intelligence.jazzer.api.FuzzedDataProvider; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.formula.EvaluationCell; +import org.apache.poi.ss.formula.FormulaParseException; +import org.apache.poi.ss.formula.WorkbookEvaluator; +import org.apache.poi.ss.formula.eval.NotImplementedException; +import org.apache.poi.ss.usermodel.FormulaError; +import org.apache.poi.util.RecordFormatException; + +/** + * Fuzz target for the Apache POI WorkbookEvaluator engine. + * <p> + * This fuzzer exercises the core formula evaluation pipeline by + * setting fuzz-generated formulas on a pre-populated workbook and + * evaluating them through the {@link WorkbookEvaluator}. A 20x20 data + * grid with mixed cell types (numbers, strings, booleans, errors) + * ensures that referential functions (SUM, VLOOKUP, INDEX, etc.) + * reach deep evaluation branches. + * <p> + * Used by Google's OSS-Fuzz for continuous security testing. + */ +public class WorkbookEvaluatorFuzzer { + private static HSSFWorkbook workbook; Review Comment: @centic9 alright, i have refactord both the files to remove all static state -- 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]
