[Tile-serving] [openstreetmap/mod_tile] PVS-Studio warnings (#140)
Darafei Praliaskouski
notifications at github.com
Wed Oct 5 16:18:51 UTC 2016
It looks like PVS-Studio found several issues in the code:
```
Viva64-EM<#~>full<#~>87<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_file.c<#~>error<#~>V526<#~>The 'memcmp' function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~> 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);<#~>
Viva64-EM<#~>full<#~>86<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_file.c<#~>error<#~>V526<#~>The 'memcmp' function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~> }<#~> if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) {<#~> if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) {<#~>
Viva64-EM<#~>full<#~>87<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_file.c<#~>error<#~>V526<#~>The 'memcmp' function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~> 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);<#~>
Viva64-EM<#~>full<#~>86<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_file.c<#~>error<#~>V526<#~>The 'memcmp' function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~> }<#~> if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) {<#~> if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) {<#~>
Viva64-EM<#~>full<#~>87<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_file.c<#~>error<#~>V526<#~>The 'memcmp' function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~> 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);<#~>
Viva64-EM<#~>full<#~>86<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_file.c<#~>error<#~>V526<#~>The 'memcmp' function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~> }<#~> if (memcmp(m->magic, META_MAGIC, strlen(META_MAGIC))) {<#~> if (memcmp(m->magic, META_MAGIC_COMPRESSED, strlen(META_MAGIC_COMPRESSED))) {<#~>
Viva64-EM<#~>full<#~>49<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_ro_http_proxy.c<#~>error<#~>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 {<#~>
Viva64-EM<#~>full<#~>182<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_ro_http_proxy.c<#~>error<#~>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
Viva64-EM<#~>full<#~>849<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_dirty"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>887<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if (strcmp(r->handler, "tile_serve"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>988<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_status"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1031<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_json"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1103<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if (strcmp(r->handler, "tile_mod_stats"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1179<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_serve"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1424<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>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);<#~>
Viva64-EM<#~>full<#~>1499<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>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
Viva64-EM<#~>full<#~>849<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_dirty"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>887<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if (strcmp(r->handler, "tile_serve"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>988<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_status"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1031<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_json"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1103<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if (strcmp(r->handler, "tile_mod_stats"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1179<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_serve"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1424<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>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);<#~>
Viva64-EM<#~>full<#~>1499<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>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
Viva64-EM<#~>full<#~>49<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_ro_http_proxy.c<#~>error<#~>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 {<#~>
Viva64-EM<#~>full<#~>182<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_ro_http_proxy.c<#~>error<#~>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
Viva64-EM<#~>full<#~>849<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_dirty"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>887<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if (strcmp(r->handler, "tile_serve"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>988<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_status"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1031<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_json"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1103<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if (strcmp(r->handler, "tile_mod_stats"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1179<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>V526<#~>The 'strcmp' function returns 0 if corresponding strings are equal. Consider examining the condition for mistakes.<#~>false<#~>3<#~><#~> if(strcmp(r->handler, "tile_serve"))<#~> return DECLINED;<#~>
Viva64-EM<#~>full<#~>1424<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>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);<#~>
Viva64-EM<#~>full<#~>1499<#~>/mnt/ssd/home/kom/proj/mod_tile/src/mod_tile.c<#~>error<#~>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
Viva64-EM<#~>full<#~>49<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_ro_http_proxy.c<#~>error<#~>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 {<#~>
Viva64-EM<#~>full<#~>182<#~>/mnt/ssd/home/kom/proj/mod_tile/src/store_ro_http_proxy.c<#~>error<#~>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
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/mod_tile/issues/140
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20161005/fe222f45/attachment-0001.html>
More information about the Tile-serving
mailing list