Skip to content

Conversation

@edgomez
Copy link
Member

@edgomez edgomez commented Apr 21, 2012

More of a test to see if everything is setup correctly between darktable-org repo and my fork.

Improvements expected later.

PS: dunno how to tell github i want darktable-org:filtering to be updated up to edgomez:filtering, i do not ask for master merge :-\

edgomez and others added 20 commits April 10, 2012 19:39
this header contains all the necessary functions to compute
a lanczos filter for interpolation, and apply it

Signed-off-by: Edouard Gomez <[email protected]>
- turn the filter size into a module static const
- fixed roi for lens module
- add a framework for more interpolators
- funcs now start with _ for private functions
- funcs now start with dt_interpolation_ for public functions
- add bilinear interpolation function + interpolator entry
- add a lanczos2 interpolator entry
- add a lanczos3 interpolator entry
- add preference entry to schema
- add function helper to retrieve interolator type
- use it for lens and clipping
saves an instruction or two, mainly on our side (no need to walk the buffer before passing it on).
cached mem for temporary uncompressed buffers instead of malloc/free.
should make vmpeak a little lower, maybe.
@edgomez edgomez closed this Apr 23, 2012
@LebedevRI LebedevRI mentioned this pull request Jun 10, 2014
LebedevRI added a commit that referenced this pull request Nov 21, 2014
This was probably missed (or it was not noticed) in 78fc8af

Fixes:
=================================================================
==19419==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f31036b66e0 at pc 0x7f31cd73ce7a bp 0x7f3145815a80 sp 0x7f3145815a78
READ of size 4 at 0x7f31036b66e0 thread T57
    #0 0x7f31cd73ce79 in _blend_normal_unbounded /home/lebedevri/darktable/src/develop/blend.c:486
    #1 0x7f31cd744916 in dt_develop_blend_process._omp_fn.6 /home/lebedevri/darktable/src/develop/blend.c:2194
    #2 0x7f31c6ba5715 (/usr/lib/x86_64-linux-gnu/libgomp.so.1+0xd715)
    #3 0x7f31c9db80a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x80a3)
    #4 0x7f31c68cdccc in clone (/lib/x86_64-linux-gnu/libc.so.6+0xe5ccc)

0x7f31036b66e0 is located 0 bytes to the right of 89644768-byte region [0x7f30fe138800,0x7f31036b66e0)
allocated by thread T10 here:
    #0 0x7f31cdbd4c9b in __interceptor_posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x54c9b)
    #1 0x7f31cd65c18d in dt_alloc_align /home/lebedevri/darktable/src/common/darktable.c:997
    #2 0x7f31cd731cd8 in dt_dev_pixelpipe_cache_get_weighted /home/lebedevri/darktable/src/develop/pixelpipe_cache.c:163
    #3 0x7f31cd7369dd in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:827
    #4 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #5 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #6 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #7 0x7f31cd732c54 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:814
    #8 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #9 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #10 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #11 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #12 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #13 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #14 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #15 0x7f31cd732c54 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:814
    #16 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #17 0x7f31cd732c54 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:814
    #18 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #19 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #20 0x7f31cd732c54 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:814
    #21 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #22 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #23 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #24 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #25 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #26 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #27 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #28 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689
    #29 0x7f31cd732452 in dt_dev_pixelpipe_process_rec /home/lebedevri/darktable/src/develop/pixelpipe_hb.c:689

Thread T57 created by T10 here:
    #0 0x7f31cdba3bba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
    #1 0x7f31c6ba5c56 (/usr/lib/x86_64-linux-gnu/libgomp.so.1+0xdc56)
    #2 0x7f31c6ba17d9 in GOMP_parallel (/usr/lib/x86_64-linux-gnu/libgomp.so.1+0x97d9)
    #3 0x3ed921823dcccccc

Thread T10 created by T0 here:
    #0 0x7f31cdba3bba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
    #1 0x7f31cd6fc149 in dt_control_jobs_init /home/lebedevri/darktable/src/control/jobs.c:512
    #2 0x7f31cd6f1945 in dt_control_init /home/lebedevri/darktable/src/control/control.c:317
    #3 0x7f31cd65fe3c in dt_init /home/lebedevri/darktable/src/common/darktable.c:745
    #4 0x400b7f in main /home/lebedevri/darktable/src/main.c:24
    #5 0x7f31c6809b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lebedevri/darktable/src/develop/blend.c:486 _blend_normal_unbounded
Shadow bytes around the buggy address:
  0x0fe6a06cec80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe6a06cec90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe6a06ceca0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe6a06cecb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fe6a06cecc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0fe6a06cecd0: 00 00 00 00 00 00 00 00 00 00 00 00[fa]fa fa fa
  0x0fe6a06cece0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe6a06cecf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe6a06ced00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe6a06ced10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0fe6a06ced20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Contiguous container OOB:fc
  ASan internal:           fe
==19419==ABORTING
pedrocr added a commit that referenced this pull request Jan 1, 2015
Exiv2 thumbs: do not crash if there was no thumb
LebedevRI added a commit that referenced this pull request Feb 26, 2015
…s longer than 19 symbols

We use  char op[20];  to store iop names, and if somehow we end up with iop
with long-enough name, we end up overflowing stack:

==23602==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff00816974 at pc 0x7fdcbfbce3f2 bp 0x7fff00816810 sp 0x7fff00816808
WRITE of size 1 at 0x7fff00816974 thread T0
    #0 0x7fdcbfbce3f1 in dt_iop_load_modules_so /home/lebedevri/darktable/src/develop/imageop.c:1214
    #1 0x7fdcbfb00229 in dt_init /home/lebedevri/darktable/src/common/darktable.c:873
    #2 0x400b9f in main /home/lebedevri/darktable/src/main.c:24
    #3 0x7fdcb80b1b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
    #4 0x400c22 (/usr/local/bin/darktable+0x400c22)

Address 0x7fff00816974 is located in stack of thread T0 at offset 180 in frame
    #0 0x7fdcbfbcc92f in dt_iop_load_modules_so /home/lebedevri/darktable/src/develop/imageop.c:1196

  This frame has 5 object(s):
    [32, 40) 'stmt'
    [96, 104) 'stmt'
    [160, 180) 'op' <== Memory access at offset 180 overflows this variable
    [224, 1248) 'path'
    [1280, 5376) 'plugindir'

SUMMARY: AddressSanitizer: stack-buffer-overflow /home/lebedevri/darktable/src/develop/imageop.c:1214 dt_iop_load_modules_so
...
==23602==ABORTING

Now, if we encounter such an iop (e.g. libexposure123456789012.so), we will simply fail to load it:
[iop_load_module] failed to open operation `exposure12345678901': /usr/local/lib/darktable/plugins/libexposure12345678901.so: cannot open shared object file: No such file or directory

While there, also add check to the CMake add_iop() macro to prevent adding such iops.
LebedevRI added a commit that referenced this pull request Feb 26, 2015
…s longer than 19 symbols

We use  char op[20];  to store iop names, and if somehow we end up with iop
with long-enough name, we end up overflowing stack:

==23602==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff00816974 at pc 0x7fdcbfbce3f2 bp 0x7fff00816810 sp 0x7fff00816808
WRITE of size 1 at 0x7fff00816974 thread T0
    #0 0x7fdcbfbce3f1 in dt_iop_load_modules_so /home/lebedevri/darktable/src/develop/imageop.c:1214
    #1 0x7fdcbfb00229 in dt_init /home/lebedevri/darktable/src/common/darktable.c:873
    #2 0x400b9f in main /home/lebedevri/darktable/src/main.c:24
    #3 0x7fdcb80b1b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
    #4 0x400c22 (/usr/local/bin/darktable+0x400c22)

Address 0x7fff00816974 is located in stack of thread T0 at offset 180 in frame
    #0 0x7fdcbfbcc92f in dt_iop_load_modules_so /home/lebedevri/darktable/src/develop/imageop.c:1196

  This frame has 5 object(s):
    [32, 40) 'stmt'
    [96, 104) 'stmt'
    [160, 180) 'op' <== Memory access at offset 180 overflows this variable
    [224, 1248) 'path'
    [1280, 5376) 'plugindir'

SUMMARY: AddressSanitizer: stack-buffer-overflow /home/lebedevri/darktable/src/develop/imageop.c:1214 dt_iop_load_modules_so
...
==23602==ABORTING

Now, if we encounter such an iop (e.g. libexposure123456789012.so), we will simply fail to load it:
[iop_load_module] failed to open operation `exposure12345678901': /usr/local/lib/darktable/plugins/libexposure12345678901.so: cannot open shared object file: No such file or directory

While there, also add check to the CMake add_iop() macro to prevent adding such iops.

(cherry picked from commit 8bfcc8c)
LebedevRI added a commit that referenced this pull request May 17, 2015
…o module

Fixes following issue: (refs #10455, comment 3)
1. (empty history stack) change exposure
2. add new exposure iop instance
3. change exposure in second instance
4. delete that new instance
5. change exposure in original instance

=================================================================
31502ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6190023d489c at pc 0x7f073823a423 bp 0x7ffd3f9349d0 sp 0x7ffd3f9349c8
READ of size 4 at 0x6190023d489c thread T0
#0 0x7f073823a422 in dt_dev_add_history_item /home/lebedevri/darktable/src/develop/develop.c:557
#1 0x7f0711886433 in exposure_set_white /home/lebedevri/darktable/src/iop/exposure.c:661
#2 0x7f0711886882 in dt_iop_exposure_set_white /home/lebedevri/darktable/src/iop/exposure.c:682
#3 0x7f07118869e2 in exposure_callback /home/lebedevri/darktable/src/iop/exposure.c:827
#4 0x7f0735ee0503 (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x10503)
#5 0x7f0735ef9fa6 in g_signal_emit_valist (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x29fa6)
#6 0x7f0735efae49 in g_signal_emit_by_name (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x2ae49)
#7 0x7f073814fe94 in dt_bauhaus_slider_set_normalized /home/lebedevri/darktable/src/bauhaus/bauhaus.c:1937
#8 0x7f07381535c6 in dt_bauhaus_slider_scroll /home/lebedevri/darktable/src/bauhaus/bauhaus.c:1781
#9 0x7f07379ad41d (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x1ed41d)
#10 0x7f0735ee0503 (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x10503)
#11 0x7f0735ef9a4f in g_signal_emit_valist (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x29a4f)
#12 0x7f0735efa8fe in g_signal_emit (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x2a8fe)
#13 0x7f0737addde3 (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x31dde3)
#14 0x7f07379aad2d (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x1ead2d)
#15 0x7f07379ac93d in gtk_main_do_event (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x1ec93d)
#16 0x7f073754fb11 (/usr/lib/x86_64-linux-gnu/libgdk-3.so.0+0x4fb11)
#17 0x7f0735c09c3c in g_main_context_dispatch (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x49c3c)
#18 0x7f0735c09f1f (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x49f1f)
#19 0x7f0735c0a241 in g_main_loop_run (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a241)
#20 0x7f07379abbf4 in gtk_main (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x1ebbf4)
#21 0x7f073833ec96 in dt_gui_gtk_run /home/lebedevri/darktable/src/gui/gtk.c:964
#22 0x400cf3 in main /home/lebedevri/darktable/src/main.c:25
#23 0x7f07309e9b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
#24 0x400bd8 (/usr/local/bin/darktable+0x400bd8)

AddressSanitizer can not describe address in more detail (wild memory access suspected).
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lebedevri/darktable/src/develop/develop.c:557 dt_dev_add_history_item
...
31502ABORTING
This was referenced Jan 10, 2024
@davidvj davidvj mentioned this pull request Feb 18, 2024
@andrewmarkotenko andrewmarkotenko mentioned this pull request Sep 3, 2025
1 task
@gi-man gi-man mentioned this pull request Sep 8, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants