Skip to main content
QUICK REVIEW

[Paper Review] Inputs from Hell: Generating Uncommon Inputs from Common Samples

Esteban Pavese, Ezekiel Soremekun|arXiv (Cornell University)|Dec 18, 2018
Software Testing and Debugging TechniquesComputer Science17 references3 citations
TL;DR

This paper proposes a method to generate both common and uncommon, yet syntactically valid, inputs using a context-free grammar and input samples. By mining production probabilities from common inputs and inverting them, the approach generates 'inputs from hell'—rare, edge-case inputs that expose untested code paths, effectively enabling robustness testing and coverage of previously uncovered behavior in programs processing structured inputs like JSON, JavaScript, and CSS.

ABSTRACT

Generating structured input files to test programs can be performed by techniques that produce them from a grammar that serves as the specification for syntactically correct input files. Two interesting scenarios then arise for effective testing. In the first scenario, software engineers would like to generate inputs that are as similar as possible to the inputs in common usage of the program, to test the reliability of the program. More interesting is the second scenario where inputs should be as dissimilar as possible from normal usage. This is useful for robustness testing and exploring yet uncovered behavior. To provide test cases for both scenarios, we leverage a context-free grammar to parse a set of sample input files that represent the program's common usage, and determine probabilities for individual grammar production as they occur during parsing the inputs. Replicating these probabilities during grammar-based test input generation, we obtain inputs that are close to the samples. Inverting these probabilities yields inputs that are strongly dissimilar to common inputs, yet still valid with respect to the grammar. Our evaluation on three common input formats (JSON, JavaScript, CSS) shows the effectiveness of these approaches in obtaining instances from both sets of inputs.

Motivation & Objective

  • To address the challenge of generating syntactically valid but uncommon inputs that stress-test rarely executed code paths in software.
  • To provide a method that leverages existing input samples and a formal grammar to produce inputs similar to common usage for regression testing.
  • To invert mined probabilities from common inputs to generate 'inputs from hell'—uncommon, valid inputs that explore untested program behavior.
  • To offer a cost-effective, general-purpose technique for enhancing software testing beyond standard fuzzing and grammar-based generation.

Proposed method

  • Parse a set of common input samples using a context-free grammar to extract production rule frequencies.
  • Construct a probabilistic grammar by assigning probabilities to grammar rules based on their observed frequencies in the input samples.
  • Generate inputs similar to the samples by sampling from the probabilistic grammar using the mined probabilities.
  • Invert the probabilities of grammar rules to create a second probabilistic grammar that favors rare, uncommon production choices.
  • Generate 'inputs from hell' by sampling from the inverted probabilistic grammar, ensuring syntactic validity while maximizing dissimilarity to common inputs.
  • Evaluate the approach on three input formats—JSON, JavaScript, and CSS—measuring code coverage and failure discovery.

Experimental results

Research questions

  • RQ1Can probabilistic grammars mined from common input samples effectively generate inputs similar to those in typical usage?
  • RQ2Can inverting the probabilities of grammar rules produce syntactically valid inputs that are markedly dissimilar to common inputs?
  • RQ3To what extent do 'inputs from hell' discovered via inverted probabilities trigger previously uncovered code paths in target programs?
  • RQ4How does the approach compare to standard fuzzing or grammar-based generation in terms of code coverage and failure discovery?

Key findings

  • The approach successfully generated inputs that covered the same code regions as original sample inputs, validating its effectiveness for regression and similarity-based testing.
  • The inverted probabilistic grammar consistently produced inputs that triggered new code paths not covered by the original samples, demonstrating success in robustness testing.
  • In evaluations on JSON, JavaScript, and CSS, the method repeatedly uncovered new code coverage, particularly in less-frequented language constructs such as destructuring assignments and complex nested expressions.
  • The approach outperformed standard grammar-based generation by focusing on rare, high-impact input patterns that are otherwise missed by conventional fuzzing.
  • The method demonstrated practical feasibility, with a low engineering cost when a formal grammar is available, and scalability to real-world input formats.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.