Audi’s Cruise Control “>=” Bug

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, January 11, 2015

Follow me on Twitter as @mattiasgeniar

I noticed a “bug” in the way Audi handles its Cruise Control options. Cruise control is only meant to be used once you drive “30 kilometers per hour or more”. However, the controls only allow you to activate cruise control at 31km/h. Once the cruise control is active, you can dial it down to 30km/h again.

This seems like there are 2 independent controls happening, each determining how to handle user input.

The source code below is my own. I do not have access to the real Audi on-board controller source code. They are here for demonstration purposes only.

The speed limit seems to be a constant.

const CRUISE_CONTROL_MINIMUM = 30;

But the handling is different. For instance, when you first activate cruise control, this is the check in the function/method/controller (whatever it may be) to validate the input.

if (CURRENT_SPEED > CRUISE_CONTROL_MINIMUM) {
  /* Current speed exceeds the CRUISE_CONTROL_MINIMUM (more than 30km/h), it's allowed */
  CURRENT_CRUISE_CONTROL = CURRENT_SPEED;
}

This check makes sure you can only activate cruise control at 31km/h or more.

cruise_control_audi_31km

If you want to change the speed configured on the car, the following check appears to happen.

if (CURRENT_CRUISE_CONTROL >= CRUISE_CONTROL_MINIMUM) {
  /* Cruis control is set to CRUISE_CONTROL_MINIMUM or higher (30km/h or more), it's allowed */
  ...
}

This allows you to set the cruise control speed back to 30km/h.

cruise_control_audi_30km

Notice the difference in “>” (greater than) and “>=” (greater than or equals) in the equation. Such a check allows you to set the cruise control to 30km/h, but only after you’ve first enabled it at 31km/h or more.

This seems like something QA should have caught. Unless there are strict car regulations that would only allow cruise control at more than 30km/h? Sounds silly.

If you live in a country with way too many 30km/h zones, you notice this. And it bugs me. Pun intended.



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.