SVM::predict crashes (Bug #2051)


Added by Dominique M. over 12 years ago. Updated over 12 years ago.


Status:Cancelled Start date:2012-06-14
Priority:High Due date:
Assignee:Maria Dimashova % Done:

0%

Category:trash
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

I create a SVM with svm(data, responses); and predict with svm.predict(sample, true);
It crashes because it tries to allocate 572662307 bytes. I stepped through the code with the debugger found that class_labels contains bogus data, but could no figure out why.
the line cv::AutoBuffer<float> _buffer(sv_total + (class_count+1)*2); causes the huge allocation attempt.

this is the contents of class_labels:

- class_labels 0x04a670d0 {type=-572662307 step=-572662307 refcount=0xdddddddd ...} CvMat *
type -572662307 int
step -572662307 int
+ refcount 0xdddddddd int *
hdr_refcount -572662307 int
+ data {ptr=0xdddddddd <Schlechtes Ptr> s=0xdddddddd i=0xdddddddd ...} CvMat::<unnamed-type-data>
rows -572662307 int
height -572662307 int
cols -572662307 int
width -572662307 int

this is the relevant part of the call stack:

msvcr100d.dll!operator new(unsigned int size)  Line 59 + 0x9 Bytes    C++
opencv_ml241d.dll!operator new[](unsigned int count) Line 6 + 0x9 Bytes C++
opencv_ml241d.dll!cv::allocate&lt;float&gt;(unsigned int n) Line 303 + 0x19 Bytes C++
opencv_ml241d.dll!cv::AutoBuffer&lt;float,1032&gt;::allocate(unsigned int _size) Line 2562 + 0x9 Bytes C++
opencv_ml241d.dll!cv::AutoBuffer&lt;float,1032&gt;::AutoBuffer&lt;float,1032&gt;(unsigned int _size) Line 2550 C++
opencv_ml241d.dll!CvSVM::predict(const float * row_sample, int row_len, bool returnDFVal) Line 2010 + 0x19 Bytes C++

It's opencv 2.4.1 32bit on windows 7 compiled with vs2010
I can supply more information if you tell me what you need.


Associated revisions

Revision 1e27b07e
Added by Roman Donchenko about 11 years ago

Merge pull request #2051 from AlexWillisson:patch-2

History

Updated by Dominique M. over 12 years ago

please close. (or better delete because it's an embarrassing product of late night coding)
the svm was destructed before the SVM::predict call

Updated by Andrey Kamaev over 12 years ago

Closed.

  • Status changed from Open to Cancelled
  • Category changed from ml to trash

Also available in: Atom PDF