[ quantlib-Bugs-1966376 ] Bug: isInSubset

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ quantlib-Bugs-1966376 ] Bug: isInSubset

SourceForge.net
Bugs item #1966376, was opened at 2008-05-18 10:36
Message generated for change (Comment added) made by lballabio
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=1966376&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Luigi Ballabio (lballabio)
Summary: Bug: isInSubset

Initial Comment:
Hello,

the function isInSubset in ql/models/marketmodels/utilities.cpp crashes in some cases.

Subset loop:

while (true) {
  subsetElement = subset[j];
  result[i] = false;
  if (setElement < subsetElement) break;
  if (setElement == subsetElement) {
    result[i] = true;
    break;
  }
  if (j > dimsubSet-1) break;
  ++j;
}

The largest allowed j in the line with the break is j==dimsubSet-1. In the next line j is increased by 1 and we have j==dimsubSet. The next statement at the beginning of the while-loop will exceed the array-boundary:
subsetElement = subset[j].

I think a greater or equal would be a solution:
if (j >= dimsubSet-1) break;

Kind regards
Jan van Heys

email: [hidden email]


----------------------------------------------------------------------

Comment By: Luigi Ballabio (lballabio)
Date: 2008-06-30 18:16

Message:
Logged In: YES
user_id=75450
Originator: NO

The bug is now fixed in the Subversion repository.
Thank you for the report.


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=1966376&group_id=12740

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev