diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-08-27 13:01:34 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-08-27 13:01:34 +0400 |
commit | b563039b8fb6b26804a13180efee83f892b6c939 (patch) | |
tree | 7c5c78878fbd28e340a534fdd98884b5a0139ced /source/blender/editors/space_sequencer | |
parent | 5d60dabef468a79c7d253f53dc19b89a0f36fe80 (diff) |
Sequencer: fix crash of histogram view for float images
Overexposured pixels lead to wrong memory access in histogram making function
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_scopes.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 5debeaf79ae..6f460500bc4 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -470,7 +470,7 @@ static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf) unsigned int bins[3][256]; - memset(bins, 0, 3 * 256 * sizeof(unsigned int)); + memset(bins, 0, sizeof(bins)); for (y = 0; y < ibuf->y; y++) { for (x = 0; x < ibuf->x; x++) { @@ -507,10 +507,10 @@ static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf) static int get_bin_float(float f) { if (f < -0.25f) { - f = -0.25f; + return 0; } - else if (f > 1.25f) { - f = 1.25f; + else if (f >= 1.25f) { + return 511; } return (int) (((f + 0.25f) / 1.5f) * 512); @@ -524,7 +524,7 @@ static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf) unsigned int bins[3][512]; - memset(bins, 0, 3 * 256 * sizeof(unsigned int)); + memset(bins, 0, sizeof(bins)); for (y = 0; y < ibuf->y; y++) { for (x = 0; x < ibuf->x; x++) { |