History

avfilter/vf_blurdetect: fix uninitialized variables and possible div by zero

Thilo Borgmann committed 4 years ago

Commit 79286d31 parent 39f22df1 file · +2 −1Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_blurdetect.c+2−1
@@ -138,6 +138,7 @@ static float edge_width(BLRContext *blr, int i, int j, int8_t dir, int w, int h, · 137 unmodified lines
138138 case DIRECTION_VERTICAL: dX = 0; dY = 1; break;
139139 case DIRECTION_45UP: dX = 1; dY = -1; break;
140140 case DIRECTION_45DOWN: dX = 1; dY = 1; break;
141+ default: dX = 1; dY = 1; break;
141142 }
142143
143144 // determines if search in direction dX/dY is looking for a maximum or minimum
@@ -227,7 +228,7 @@ static float calculate_blur(BLRContext *s, int w, int h, int hsub, int vsub, · 83 unmodified lines
227228 }
228229 }
229230 // if not enough edge pixels in a block, consider it smooth
230− if (block_total_width >= 2) {
231+ if (block_total_width >= 2 && block_count) {
231232 blks[blkcnt] = block_total_width / block_count;
232233 blkcnt++;
233234 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t