Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/bid x y causes overbid #3

Open
AkiTensai opened this issue Aug 11, 2013 · 3 comments
Open

/bid x y causes overbid #3

AkiTensai opened this issue Aug 11, 2013 · 3 comments

Comments

@AkiTensai
Copy link

/bid x y can cause an over bid above what the user asked to bid.

Steps to replicate:
One players auctions:
/auc 64 100 1000 59

Second player bids:
/bid

A third player bids:
/bid 0 300

Player three then has a bid up for $1000, well over what they asked their max to be.

(/auc about and /auc ? doesn't state a version number.)

@AkiTensai
Copy link
Author

Looking at the code, '/bid 0 300' is seen as the same as '/bid'. The code assumes next bid.

@AkiTensai
Copy link
Author

In AuctionBid.java:parseArgBid() ln 148
bidAmount = currentBid.getBidAmount() + auction.getMinBidIncrement();
This line can't gain needed validation of the user's request for max bid (currentBid + MinBidIncrement > MaxBid).

This leaves the validation of "if max bid is under requested 0 bid, don't bid" falls to parseArgMaxBid.
Currently, ln 171 pushes max bid to min bids amount. In the case of /bid 0 x, it shouldn't. Could this section either gain validation that max bid can't be less then bid amount, or a check of the args that a zero request was made?

I see '/bid 0 y' to mean "raise max bid to" not "auto bid always, then raise max bid to"

@AkiTensai
Copy link
Author

Replacing within parseArgMaxBid():

maxBidAmount = Math.max(bidAmount, maxBidAmount);

With:

if (maxBidAmount < bidAmount) {
error = "parse-error-invalid-bid";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant