Project

Profile

Help

Bug #6043

closed

A zero-length command line argument causes an index out-of-bounds exception

Added by Norm Tovey-Walsh 12 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2023-05-22
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, 12, trunk
Fix Committed on Branch:
11, 12, trunk
Fixed in Maintenance Release:
Platforms:

Description

If you conspire to pass a zero length string to net.sf.saxon.Transform as a command line argument, we throw an index out-of-bounds exception.

(How, exactly, you do this is perhaps platform dependent, but it appears that on Windows at least java "" ... will result in a zero length string being passed as an argument.)

Then the question is, how should we react to this argument? Ignore it, or reject it and print the usage message? I'm leaning towards the latter.

Actions #1

Updated by Norm Tovey-Walsh 12 months ago

This seems to work:

    public void setActualOptions(/*@NotNull*/ String[] args) throws XPathException {
        for (String arg : args) {
            if ("".equals(arg)) {
                throw new XPathException("An empty string is not a valid command line option");
            } else if ("-".equals(arg)) {
     ...

Anyone disagree with making it an error or the message?

Actions #2

Updated by Michael Kay 12 months ago

Looks a good fix to me.

Actions #3

Updated by Norm Tovey-Walsh 11 months ago

  • Status changed from New to Resolved
  • Applies to branch 11, 12, trunk added
  • Fix Committed on Branch 11, 12, trunk added

Fix pushed to 11, 12, and main.

Actions #4

Updated by O'Neil Delpratt 10 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 12.3 added

Bug fix applied in the Saxon 12.3 maintenance release.

Actions #5

Updated by O'Neil Delpratt 10 months ago

  • Status changed from Closed to Resolved

Leaving this bug issue as resolved until resolved against Saxon 11.

Actions #6

Updated by Debbie Lockett 8 months ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 11.6 added

Bug fix applied in the Saxon 11.6 maintenance release.

Please register to edit this issue

Also available in: Atom PDF