openstreetmap / openstreetmap/mod_tile
PVS-Studio warnings
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 318
- Forks
- 199
- PR merge metrics
- No merged PRs in 30d
Description
It looks like PVS-Studio found several issues in the code:
- 87 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { : snprintf(log_msg,PATH_MAX - 1, "Meta file %s header magic mismatch\n", path); :
- 86 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. } : if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { :
- 87 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { : snprintf(log_msg,PATH_MAX - 1, "Meta file %s header magic mismatch\n", path); :
- 86 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. } : if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { :
- 87 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { : snprintf(log_msg,PATH_MAX - 1, "Meta file %s header magic mismatch\n", path); :
- 86 : src/store_file.c V526 : The 'memcmp' function returns 0 if corresponding buffers are equal. } : if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) { : if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) { :
- 49 : src/store_ro_http_proxy.c V701 : realloc() possible leak: when realloc() fails in allocating memory, original pointer 'chunk->memory' is lost. Consider assigning realloc() to a temporary pointer. : false : 2 : if (chunk->memory) { : chunk->memory = realloc(chunk->memory, chunk->size + realsize); : } else { :
- 182 : src/store_ro_http_proxy.c V524 : It is odd that the body of 'ro_http_proxy_metatile_expire' function is fully equivalent to the body of 'ro_http_proxy_metatile_delete' function. : false : 3 : : static int ro_http_proxy_metatile_expire(struct storage_backend * store, const char *xmlconfig, int x, int y, int z) { : : 177,182
- 849 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_dirty")) : return DECLINED; :
- 887 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_serve")) : return DECLINED; :
- 988 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_status")) : return DECLINED; :
- 1031 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_json")) : return DECLINED; :
- 1103 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_mod_stats")) : return DECLINED; :
- 1179 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_serve")) : return DECLINED; :
- 1424 : src/mod_tile.c V566 : The integer constant is converted to pointer. Possibly an error or a bad coding style: (const void *) 1 : false : 3 : if (!data) { : apr_pool_userdata_set((const void *) 1, userdata_key, : apr_pool_cleanup_null, s->process->pool); :
- 1499 : src/mod_tile.c V656 : Variables 'delayp->last_tile_fillup', 'delayp->last_render_fillup' are initialized through the call to the same function. It's probably an error or un-optimized code. Consider inspecting the 'apr_time_now()' expression. Check lines: 1498, 1499. : false : 3 : delayp->last_tile_fillup = apr_time_now(); : delayp->last_render_fillup = apr_time_now(); : : 1498,1499
- 849 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_dirty")) : return DECLINED; :
- 887 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_serve")) : return DECLINED; :
- 988 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_status")) : return DECLINED; :
- 1031 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_json")) : return DECLINED; :
- 1103 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_mod_stats")) : return DECLINED; :
- 1179 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_serve")) : return DECLINED; :
- 1424 : src/mod_tile.c V566 : The integer constant is converted to pointer. Possibly an error or a bad coding style: (const void *) 1 : false : 3 : if (!data) { : apr_pool_userdata_set((const void *) 1, userdata_key, : apr_pool_cleanup_null, s->process->pool); :
- 1499 : src/mod_tile.c V656 : Variables 'delayp->last_tile_fillup', 'delayp->last_render_fillup' are initialized through the call to the same function. It's probably an error or un-optimized code. Consider inspecting the 'apr_time_now()' expression. Check lines: 1498, 1499. : false : 3 : delayp->last_tile_fillup = apr_time_now(); : delayp->last_render_fillup = apr_time_now(); : : 1498,1499
- 49 : src/store_ro_http_proxy.c V701 : realloc() possible leak: when realloc() fails in allocating memory, original pointer 'chunk->memory' is lost. Consider assigning realloc() to a temporary pointer. : false : 2 : if (chunk->memory) { : chunk->memory = realloc(chunk->memory, chunk->size + realsize); : } else { :
- 182 : src/store_ro_http_proxy.c V524 : It is odd that the body of 'ro_http_proxy_metatile_expire' function is fully equivalent to the body of 'ro_http_proxy_metatile_delete' function. : false : 3 : : static int ro_http_proxy_metatile_expire(struct storage_backend * store, const char *xmlconfig, int x, int y, int z) { : : 177,182
- 849 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_dirty")) : return DECLINED; :
- 887 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_serve")) : return DECLINED; :
- 988 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_status")) : return DECLINED; :
- 1031 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_json")) : return DECLINED; :
- 1103 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if (strcmp(r->handler, "tile_mod_stats")) : return DECLINED; :
- 1179 : src/mod_tile.c V526 : The 'strcmp' function returns 0 if corresponding strings are equal. : if(strcmp(r->handler, "tile_serve")) : return DECLINED; :
- 1424 : src/mod_tile.c V566 : The integer constant is converted to pointer. Possibly an error or a bad coding style: (const void *) 1 : false : 3 : if (!data) { : apr_pool_userdata_set((const void *) 1, userdata_key, : apr_pool_cleanup_null, s->process->pool); :
- 1499 : src/mod_tile.c V656 : Variables 'delayp->last_tile_fillup', 'delayp->last_render_fillup' are initialized through the call to the same function. It's probably an error or un-optimized code. Consider inspecting the 'apr_time_now()' expression. Check lines: 1498, 1499. : false : 3 : delayp->last_tile_fillup = apr_time_now(); : delayp->last_render_fillup = apr_time_now(); : : 1498,1499
- 49 : src/store_ro_http_proxy.c V701 : realloc() possible leak: when realloc() fails in allocating memory, original pointer 'chunk->memory' is lost. Consider assigning realloc() to a temporary pointer. : false : 2 : if (chunk->memory) { : chunk->memory = realloc(chunk->memory, chunk->size + realsize); : } else { :
- 182 : src/store_ro_http_proxy.c V524 : It is odd that the body of 'ro_http_proxy_metatile_expire' function is fully equivalent to the body of 'ro_http_proxy_metatile_delete' function. : false : 3 : : static int ro_http_proxy_metatile_expire(struct storage_backend * store, const char *xmlconfig, int x, int y, int z) { : : 177,182
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the PVS-Studio findings in src/store_file.c, src/store_ro_http_proxy.c, and src/mod_tile.c, then inspect each referenced function and line. Re-run the relevant static analysis after reviewing the unchecked warnings; done means the listed findings are fixed or explicitly confirmed as intentional, with existing project checks still passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100