Package: diction / 1.11-1

bad-memory-access Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Description: Fix bad memory access
 diction: style reports large 'long sentences' due to bad memory access
Author: Justin Fletcher <gerph@gerph.org>
Reviewed-By: Chris Lawrence <lawrencc@debian.org>
Bug-Debian: http://bugs.debian.org/646749
Last-Update: 2014-04-14

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- diction-1.11.orig/style.c
+++ diction-1.11/style.c
@@ -1157,7 +1157,7 @@ int main(int argc, char *argv[]) /*{{{*/
     for (i=0,shortSent=0; i<=shortLength; ++i) shortSent+=lengths.data[i];
     printf(_("        %d%% (%d) short sentences (at most %d words)\n"),100*shortSent/sentences,shortSent,shortLength);
     longLength=((double)words)/sentences+10.5;
-    for (i=longLength,longSent=0; i<=lengths.size; ++i) longSent+=lengths.data[i];
+    for (i=longLength-1,longSent=0; i<=lengths.size; ++i) longSent+=lengths.data[i];
     printf(_("        %d%% (%d) long sentences (at least %d words)\n"),100*longSent/sentences,longSent,longLength);
     printf(_("        %d paragraphs, average length %.1f sentences\n"),paragraphs,((double)sentences)/paragraphs);
     printf(_("        %d%% (%d) questions\n"),100*questions/sentences,questions);