Changeset - r25367:9edbd4d02759
[Not reviewed]
master
0 1 0
Peter Nelson - 3 years ago 2021-05-02 09:47:05
peter1138@openttd.org
Codechange: Validate custom station platform layout tiles are permitted values only.
1 file changed with 8 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -1991,6 +1991,14 @@ static ChangeInfoResult StationChangeInf
 

	
 
					const byte *layout = buf->ReadBytes(length * number);
 
					statspec->layouts[length - 1][number - 1].assign(layout, layout + length * number);
 

	
 
					/* Validate tile values are only the permitted 00, 02, 04 and 06. */
 
					for (auto &tile : statspec->layouts[length - 1][number - 1]) {
 
						if ((tile & 6) != tile) {
 
							grfmsg(1, "StationChangeInfo: Invalid tile %u in layout %ux%u", tile, length, number);
 
							tile &= 6;
 
						}
 
					}
 
				}
 
				break;
 

	
0 comments (0 inline, 0 general)