Commit 342b042
authored
Fix(parser): Prevent crash with non-existent layer in REQUIRES (MapServer#7334)
* Fix(parser): Prevent crash with non-existent layer in REQUIRES
When a REQUIRES or LABELREQUIRES expression contains a reference to
a layer that does not exist in the mapfile, the expression parser would
treat it as an attribute binding. Since msEvalContext is called without
a shape object, this would lead to a NULL pointer dereference and a
crash when the parser tried to evaluate the binding.
This patch adds a check after tokenizing the expression to ensure no
attribute binding tokens are present. If any are found, it indicates
a reference to a non-existent layer. An error is reported and the
evaluation returns MS_FALSE, preventing the crash.
Fix generated by gemini-2.5-pro
* Add tests with non existant REQUIRES parameter triggering a failure1 parent 3c18f7e commit 342b042
File tree
4 files changed
+33
-0
lines changed- msautotest/query
- expected
- src
4 files changed
+33
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
28 | 42 | | |
Loading
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
| 577 | + | |
577 | 578 | | |
578 | 579 | | |
579 | 580 | | |
| |||
609 | 610 | | |
610 | 611 | | |
611 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
612 | 631 | | |
613 | 632 | | |
614 | 633 | | |
| |||
0 commit comments