Open Source Computer Vision Library
Go to file
Oliver Kuckertz a3d7811f24
Merge pull request #20725 from mologie:fix-dnn-tf-on-arm
* dnn: fix unaligned memory access crash on armv7

The getTensorContent function would return a Mat pointing to some
member of a Protobuf-encoded message. Protobuf does not make any
alignment guarantees, which results in a crash on armv7 when loading
models while bit 2 is set in /proc/cpu/alignment (or the relevant
kernel feature for alignment compatibility is disabled). Any read
attempt from the previously unaligned data member would send SIGBUS.

As workaround, this commit makes an aligned copy via existing clone
functionality in getTensorContent. The unsafe copy=false option is
removed. Unfortunately, a rather crude hack in PReLUSubgraph in fact
writes(!) to the Protobuf message. We limit ourselves to fixing the
alignment issues in this commit, and add getTensorContentRefUnaligned
to cover the write case with a safe memcpy. A FIXME marks the issue.

* dnn: reduce amount of .clone() calls

* dnn: update FIXME comment

Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
2021-10-06 16:41:05 +00:00
.github Updated more links to forum.opencv.org 2021-01-19 21:55:45 +03:00
3rdparty ffmpeg/3.4: update FFmpeg wrapper 2021.10 2021-10-05 10:09:27 +03:00
apps Fix typo 'Applicatioin' 2020-11-17 15:02:55 +00:00
cmake Merge pull request #20183 from xhawk18:3.4 2021-10-04 16:44:57 +00:00
data fix files permissions 2020-04-13 04:29:55 +00:00
doc pre: OpenCV 3.4.16 (version++) 2021-10-04 20:47:07 +00:00
include add missing DNN header to opencv2/opencv.hpp 2018-02-15 15:59:14 +01:00
modules Merge pull request #20725 from mologie:fix-dnn-tf-on-arm 2021-10-06 16:41:05 +00:00
platforms pre: OpenCV 3.4.16 (version++) 2021-10-04 20:47:07 +00:00
samples restore LSD 2021-10-01 16:23:16 +03:00
.editorconfig add .editorconfig 2018-10-11 17:57:51 +00:00
.gitattributes cmake: generate and install ffmpeg-download.ps1 2018-06-09 13:19:48 +03:00
.gitignore Ignore Visual Studio cmake configuration file 2020-03-17 21:12:54 +03:00
CMakeLists.txt Merge pull request #20183 from xhawk18:3.4 2021-10-04 16:44:57 +00:00
CONTRIBUTING.md migration: github.com/opencv/opencv 2016-07-12 12:51:12 +03:00
LICENSE copyright: 2021 2021-01-01 13:40:32 +00:00
README.md update forum link 2021-01-11 18:39:46 +00:00

OpenCV: Open Source Computer Vision Library

Resources

Contributing

Please read the contribution guidelines before starting work on a pull request.

Summary of the guidelines:

  • One pull request per issue;
  • Choose the right base branch;
  • Include tests and documentation;
  • Clean up "oops" commits before submitting;
  • Follow the coding style guide.