[MacPorts] #37862: libsvm 3.15 and 3.16 potential crash on svm_free_model_content()

MacPorts noreply at macports.org
Thu Jan 31 03:18:17 PST 2013


#37862: libsvm 3.15 and 3.16 potential crash on svm_free_model_content()
-------------------------------+--------------------------------
 Reporter:  andre.dos.anjos@…  |      Owner:  macports-tickets@…
     Type:  defect             |     Status:  new
 Priority:  High               |  Milestone:
Component:  ports              |    Version:  2.1.2
 Keywords:                     |       Port:  libsvm
-------------------------------+--------------------------------
 The author of libsvm introduced the following lines of code on
 libsvm-3.15/svm.cpp (also true for libsvm-3.16), for model destructors -
 `svm_free_model_content()`, around line 2977:

 {{{#!c
   free(model_ptr->sv_indices);
   model_ptr->sv_indices = NULL;
 }}}

 This works well when `svm_train()` is called before
 `svm_free_model_content()` because `svm_train()` initializes
 `model_ptr->sv_indices` properly. This is not the case for
 `svm_load_model()`, that loads a pre-trained model. The variable
 `sv_indices` is never initialized (to `NULL`) so, depending on code layout
 and compilation options, its value may be set to `!= NULL`. In those
 cases, the newly introduced code will cause a `free()` error (trying to
 deallocate unallocated memory) which leads to program abortion.

 To fix this problem, it suffices to initialize `sv_indices` properly.
 Patch attached. Could you please add this patch and re-state the build?

 Thanks, A

-- 
Ticket URL: <https://trac.macports.org/ticket/37862>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list