Skip to content

Backslashes removed from path description when that description includes a link #585

@smowton

Description

@smowton

Evaluating a trivial path-problem query that includes a link and also includes backslashes in the description results in some slashes being lost. For example, query:

/**
 * @name Test query
 * @description path-problem header is required to reproduce the bug
 * @kind path-problem
 */

import go

import DataFlow::PathGraph

class Config extends DataFlow::Configuration {
  Config() { this = "Test" }

  override predicate isSource(DataFlow::Node source) {
    exists(DataFlow::CallNode call |
      call.getTarget().getName() = "g" and
      source = call.getResult())
  }

  override predicate isSink(DataFlow::Node sink) {
    exists(DataFlow::CallNode call |
      call.getTarget().getName() = "f" and
      sink = call.getArgument(0))
  }
}

from Config c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select source, source, sink, "$@ is required to reproduce the bug. Then, these should have the same number of slashes: \\\\a and \\\\a", source, "This link"

Then the result might be expected to read ...same number of slashes: \\a and \\a, but actually reads ...same number of slashes: \a and \\a.

This does not happen if the link to source in the path description is omitted, or on lgtm.com, or in the SARIF output of a command-line analysis of the same query.

Database to reproduce: db.zip

Go source for that db:

package x

func f(x int) { }
func g() int { return 0 }

func main() {
  f(g())
}

Metadata

Metadata

Assignees

Labels

VSCodebugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions