Mercurial > hg > svcore
comparison data/model/Dense3DModelPeakCache.h @ 1192:9884efa1f88a spectrogram-minor-refactor
Fix potential crash in Dense3dModelPeakCache owing to combination of wrong width calculation and wrong handling of width overrun
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2016 14:49:04 +0100 |
parents | 6d09ad2ab21f |
children | df59bf0b4236 |
comparison
equal
deleted
inserted
replaced
1191:6d09ad2ab21f | 1192:9884efa1f88a |
---|---|
51 virtual int getColumnsPerPeak() const { | 51 virtual int getColumnsPerPeak() const { |
52 return m_columnsPerPeak; | 52 return m_columnsPerPeak; |
53 } | 53 } |
54 | 54 |
55 virtual int getWidth() const { | 55 virtual int getWidth() const { |
56 return m_source->getWidth() / m_columnsPerPeak + 1; | 56 int sourceWidth = m_source->getWidth(); |
57 if ((sourceWidth % m_columnsPerPeak) == 0) { | |
58 return sourceWidth / m_columnsPerPeak; | |
59 } else { | |
60 return sourceWidth / m_columnsPerPeak + 1; | |
61 } | |
57 } | 62 } |
58 | 63 |
59 virtual int getHeight() const { | 64 virtual int getHeight() const { |
60 return m_source->getHeight(); | 65 return m_source->getHeight(); |
61 } | 66 } |