{"action":"closed","issue":{"url":"https://api.github.com/repos/opencv/opencv/issues/4994","repository_url":"https://api.github.com/repos/opencv/opencv","labels_url":"https://api.github.com/repos/opencv/opencv/issues/4994/labels{/name}","comments_url":"https://api.github.com/repos/opencv/opencv/issues/4994/comments","events_url":"https://api.github.com/repos/opencv/opencv/issues/4994/events","html_url":"https://github.com/opencv/opencv/issues/4994","id":97441886,"number":4994,"title":"uninitialized value while saving cvflann::KDTreeIndex","user":{"login":"opencv-pushbot","id":2051563,"avatar_url":"https://avatars.githubusercontent.com/u/2051563?v=3","gravatar_id":"","url":"https://api.github.com/users/opencv-pushbot","html_url":"https://github.com/opencv-pushbot","followers_url":"https://api.github.com/users/opencv-pushbot/followers","following_url":"https://api.github.com/users/opencv-pushbot/following{/other_user}","gists_url":"https://api.github.com/users/opencv-pushbot/gists{/gist_id}","starred_url":"https://api.github.com/users/opencv-pushbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencv-pushbot/subscriptions","organizations_url":"https://api.github.com/users/opencv-pushbot/orgs","repos_url":"https://api.github.com/users/opencv-pushbot/repos","events_url":"https://api.github.com/users/opencv-pushbot/events{/privacy}","received_events_url":"https://api.github.com/users/opencv-pushbot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/opencv/opencv/labels/affected:%202.4","name":"affected: 2.4","color":"ededed"},{"url":"https://api.github.com/repos/opencv/opencv/labels/auto-transferred","name":"auto-transferred","color":"ededed"},{"url":"https://api.github.com/repos/opencv/opencv/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/opencv/opencv/labels/category:%20flann","name":"category: flann","color":"ededed"},{"url":"https://api.github.com/repos/opencv/opencv/labels/priority:%20normal","name":"priority: normal","color":"A38700"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2015-07-27T11:24:23Z","updated_at":"2016-07-19T13:43:47Z","closed_at":"2016-07-19T13:43:47Z","body":"Transferred from http://code.opencv.org/issues/4354\r\n```\n|| Reinhard Hameeteman on 2015-05-21 10:02\n|| Priority: Normal\n|| Affected: 2.4.9 (latest release)\n|| Category: flann\n|| Tracker: Bug\n|| Difficulty: Easy\n|| PR: \n|| Platform: Any / Any\n```\n\nuninitialized value while saving cvflann::KDTreeIndex\n-----------\n```\nvalgrind reports a Syscall param write(buf) points to uninitialised byte(s) error while calling cvflann::KDTreeIndex::saveIndex (see report below)\r\nThis is caused by the divval of the leaf node that is not initialized. This can easily be fixed by setting this value to zero on line 284 of modules/flann/include/opencv2/flann/kdtree_index.h:\r\nif ( count == 1) {\r\n  node->child1 = node->child2 = NULL;    /* Mark as leaf node. */\r\n  node->divval = DistanceType(0); /* Initialize in order to prevent access of uninitialized value while saving. */\r\n  node->divfeat = *ind;    /* Store index of this vec. */\r\n}\r\n\r\n\r\n  0x60E48D0: __write_nocancel (syscall-template.S:82)\r\n  0x608EEE2: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1276)\r\n  0x608EB59: new_do_write (fileops.c:530)\r\n  0x608EE84: _IO_do_write@@GLIBC_2.2.5 (fileops.c:503)\r\n  0x608ECBC: _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1358)\r\n  0x608519C: fwrite (iofwrite.c:45)\r\n  0x6F5C3A: void cvflann::save_value<cvflann::KDTreeIndex<cvflann::L2<float> >::Node>(_IO_FILE*, cvflann::KDTreeIndex<cvflann::L2<float> >::Node const&, unsigned long) (saving.h:128)\r\n  0x6FAD83: cvflann::KDTreeIndex<cvflann::L2<float> >::save_tree(_IO_FILE*, cvflann::KDTreeIndex<cvflann::L2<float> >::Node*) (kdtree_index.h:244)\r\n  0x6FAEEE: cvflann::KDTreeIndex<cvflann::L2<float> >::save_tree(_IO_FILE*, cvflann::KDTreeIndex<cvflann::L2<float> >::Node*) (kdtree_index.h:249)\r\n  0x6FB00A: cvflann::KDTreeIndex<cvflann::L2<float> >::saveIndex(_IO_FILE*) (kdtree_index.h:249)\r\n  0x6F2C87: cvflann::Index<cvflann::L2<float> >::saveIndex(_IO_FILE*) (flann_base.hpp:154)\n```\n\nHistory\n-------"}}
{"actor":{"display_login":"ilya-lavrenov"}}