Commit 7120d3c
committed
Fix code injection via unescaped doc comments in code generators
Sanitize documentation comments by escaping the block comment closing
sequence '*/' to '* /' before emitting them into generated source code.
This prevents a malicious .fbs schema from injecting arbitrary code into
generated Java, Kotlin, and C# files by prematurely terminating the
Javadoc/KDoc block comment.
The fix is applied to three locations:
- GenComment() in code_generators.cpp (used by Java and C# generators)
- GenerateComment() in idl_gen_kotlin.cpp
- GenerateComment() in idl_gen_kotlin_kmp.cpp1 parent 4e582b0 commit 7120d3c
3 files changed
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
216 | 223 | | |
217 | 224 | | |
218 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1410 | 1410 | | |
1411 | 1411 | | |
1412 | 1412 | | |
1413 | | - | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
1414 | 1421 | | |
1415 | 1422 | | |
1416 | 1423 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1393 | 1393 | | |
1394 | 1394 | | |
1395 | 1395 | | |
1396 | | - | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
1397 | 1404 | | |
1398 | 1405 | | |
1399 | 1406 | | |
| |||
0 commit comments