diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-11-24 00:31:21 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2021-11-24 00:31:24 +0100 |
| commit | a1dd3facaefd85e25a8202b7b9ea19b31278e36c (patch) | |
| tree | 6d1fb42fd9c3de338f035f16a70488fadbdd7eb0 /src | |
| parent | df894f50eeea49e70d9a76dd58972e71cb6a29e4 (diff) | |
| download | PROJ-a1dd3facaefd85e25a8202b7b9ea19b31278e36c.tar.gz PROJ-a1dd3facaefd85e25a8202b7b9ea19b31278e36c.zip | |
Pipeline parsing: reject proj=/o_proj= before first step, to avoid bad performance pattern on hostile pipelines
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41290
Diffstat (limited to 'src')
| -rw-r--r-- | src/pipeline.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pipeline.cpp b/src/pipeline.cpp index c001ba27..2f50162f 100644 --- a/src/pipeline.cpp +++ b/src/pipeline.cpp @@ -452,7 +452,19 @@ PJ *OPERATION(pipeline,0) { return destructor (P, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); /* ERROR: nested pipelines */ } i_pipeline = i; + } else if (0==nsteps && 0==strncmp(argv[i], "proj=", 5) ) { + // Non-sensical to have proj= in the general pipeline parameters. + // Would not be a big issue in itself, but this makes bad performance + // in parsing hostile pipelines more likely, such as the one of + // https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41290 + proj_log_error (P, _("Pipeline: proj= operator before first step not allowed")); + return destructor (P, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); + } else if (0==nsteps && 0==strncmp(argv[i], "o_proj=", 7) ) { + // Same as above. + proj_log_error (P, _("Pipeline: o_proj= operator before first step not allowed")); + return destructor (P, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); } + } nsteps--; /* Last instance of +step is just a sentinel */ |
