Tire manufacturers specify the range of rim widths that a given tire model and size can be mounted on. This can be found on the tire manufacturer's website and/or that of vendors such as the Tire Rack.
For example, if you look on the Tire Rack website for the Bridgestone S-03 tire, you can click on "specs" and it says that the range for this size tire is 8.5 to 10 inches. So the answer for 255/40-17 is no, you should not mount that size S-03 on a rim that is 8 inches wide. The 245/40-17 S-03 is okay for a rim that's 8 inches wide.
You will need to look up the permissible range of rim widths for the model of tire you're considering.