Class TaintMark

java.lang.Object
ghidra.taint.model.TaintMark

public class TaintMark extends Object
A taint mark

This is essentially a symbol or variable, but we also include an immutable set of tags. A mark is the bottom-most component in a TaintVec.

  • Constructor Details

    • TaintMark

      public TaintMark(String name, Set<String> tags)
      Construct a new taint mark

      TODO: Validation that the name and tags do not contain any separators, so that parse(String) and toString() are proper inverses.

      Parameters:
      name - the name
      tags - the tags
  • Method Details

    • parse

      public static TaintMark parse(String string)
      Parse a mark from the given string

      A mark has the form "name:tag1,tag2,...,tagN". The tags are optional, so it may also take the form "name".

      Parameters:
      string - the string to parse
      Returns:
      the resulting mark
    • toString

      public String toString()
      Render the mark as a string
      Overrides:
      toString in class Object
      See Also:
    • equals

      public boolean equals(Object obj)
      Check if two marks are equal

      Note that we distinguish between a mark without tags and another mark with the same name but having tags. Because we use tags to indicate, e.g., indirection, we want to allow a variable to be marked as tainted both directly and indirectly. Furthermore, if indirect taints are filtered, we would want to ensure such a variable is not removed, since it's also tainted directly.

      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getName

      public String getName()
      Get the name of the mark
      Returns:
      the name
    • getTags

      public Set<String> getTags()
      Get the mark's tags
      Returns:
      the tags
    • tagged

      public TaintMark tagged(String tag)
      Create a new mark with the given tag added

      Tags are a set, so this may return the same mark

      Parameters:
      tag -
      Returns: