pentoo-overlay/app-forensics/stegdetect/files/stegdetect-fixes.patch

317 lines
8.2 KiB
Diff

--- stegdetect-0.6/stegdetect.c 2010-01-31 20:08:52.156378849 +0100
+++ stegdetect-0.6/stegdetect.c 2010-01-31 20:12:42.045646715 +0100
@@ -78,7 +78,7 @@
float DCThist[257];
float scale = 1; /* Sensitivity scaling */
-int debug = 0;
+int _debug = 0;
static int quiet = 0;
static int ispositive = 0; /* Current images contain stego */
static char *transformname; /* Current transform name */
@@ -135,7 +135,7 @@
sum = count = 0;
for (i = x; i < y; i++) {
if ((i & ~63) == i) {
- if (debug & DBG_PRINTONES)
+ if (_debug & DBG_PRINTONES)
fprintf(stdout, "%d] %d\n", i, count);
sum += count;
count = 0;
@@ -159,7 +159,7 @@
DCThist[off + 128]++;
}
- if (debug & DBG_PRINTHIST) {
+ if (_debug & DBG_PRINTHIST) {
for (i = 0; i < 256; i++) {
fprintf(stdout, "%4d: %8.1f\n", i - 128, DCThist[i]);
}
@@ -291,7 +291,7 @@
*/
if ((fbar > f/4) &&
((f - f/3) - (fbar + f/3) > 0)) {
- if ((debug & DBG_CHIDIFF) && (one || two))
+ if ((_debug & DBG_CHIDIFF) && (one || two))
fprintf(stdout,
"%4d: %8.3f - %8.3f skipped (%f)\n",
i*2 - 128,
@@ -356,7 +356,7 @@
ymt += DCTobs[i];
ytt += DCTtheo[i];
- if (debug & DBG_CHIDIFF) {
+ if (_debug & DBG_CHIDIFF) {
if (DCTobs[i] || DCTtheo[i])
fprintf(stdout, "%4d: %8.3f - %8.3f\n", i,
DCTobs[i],
@@ -368,7 +368,7 @@
chi = ymt - ytt;
- if (debug & DBG_CHICALC) {
+ if (_debug & DBG_CHICALC) {
fprintf(stdout,
" (%8.3f - %8.3f)^2 = %8.3f / %8.3f = %8.3f | %8.3f\n",
ymt, ytt,
@@ -388,7 +388,7 @@
f = 1 - chi2cdf(sumchi, dgf - 1);
- if (debug & DBG_CHIEND) {
+ if (_debug & DBG_CHIEND) {
fprintf(stdout,
"Categories: %d, Chi: %f, Q: %f, dis: %f -> %f\n",
dgf, sumchi, f, discard, f * (1 - discard));
@@ -435,7 +435,7 @@
while (_iteration < (imaxiter))
#define BINSEARCH_NEXT(thresh) \
- if (debug & DBG_BINSRCH) \
+ if (_debug & DBG_BINSRCH) \
fprintf(stdout, "sum: %f, percent: %f, good: %f\n", \
sum, percent, _good); \
if (_iteration == 0) { \
@@ -481,7 +481,7 @@
break;
if (f > 0.4)
sum += f * percent;
- if ((debug & DBG_CHI) && f != 0)
+ if ((_debug & DBG_CHI) && f != 0)
fprintf(stdout, "%04f[:] %8.5f%% %f\n",
i, f * 100, sum);
}
@@ -491,7 +491,7 @@
BINSEARCH_IFABORT(end) {
abort:
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
fprintf(stdout,
"Accumulation: no detection possible\n");
return (-1);
@@ -528,8 +528,8 @@
}
}
- if ((debug & DBG_CHI) &&
- ((debug & DBG_PRINTZERO) || f != 0))
+ if ((_debug & DBG_CHI) &&
+ ((_debug & DBG_PRINTZERO) || f != 0))
fprintf(stdout, "%04f: %8.5f%%\n",
i, f * 100);
}
@@ -537,7 +537,7 @@
length = jsteg_size(data, bits, NULL);
minlen = where/8;
maxlen = (where + percent)/8;
- if (debug & DBG_ENDVAL) {
+ if (_debug & DBG_ENDVAL) {
fprintf(stdout,
"Accumulation (%d): %f%% - %f (%f) (%d:%d - %d)\n",
(int)percent,
@@ -596,7 +596,7 @@
f = chi2test(data, bits, unify_false_outguess,
off - range, off + range);
sum += f;
- if ((debug & DBG_CHI) && f != 0)
+ if ((_debug & DBG_CHI) && f != 0)
fprintf(stdout, "%04d[:] %8.5f%%\n",
i, f * 100);
}
@@ -618,8 +618,8 @@
sum += f;
if (f > 0.001)
count++;
- if ((debug & DBG_CHI) &&
- ((debug & DBG_PRINTZERO) || f != 0))
+ if ((_debug & DBG_CHI) &&
+ ((_debug & DBG_PRINTZERO) || f != 0))
fprintf(stdout, "%04d: %8.5f%%\n", i, f * 100);
}
@@ -631,7 +631,7 @@
norm = sum / norm_outguess[off];
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
fprintf(stdout,
"Accumulation (%4.1f%%): %8.3f%% (%8.3f%%) (%4.1f)\n",
percent,
@@ -714,7 +714,7 @@
else if (sum >= 15 && res <= -1)
negative = 1;
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
printf("Zero/One: %d : %d -> %5.1f%s\n",
one, zero, (float)res/2, negative ? " **" : "");
@@ -740,7 +740,7 @@
(!DCThist[i] || !DCThist[i+1]))
res++;
}
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
printf("Empty pairs: %d\n", res);
if (res > 3)
return (1);
@@ -770,7 +770,7 @@
buildDCTreset();
f = chi2test(data, bits, unify_jphide, 0, jphpos[0]);
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
fprintf(stdout, "Pos[0]: %04d: %8.5f%%\n", jphpos[0], f*100);
/* If JPhide was used, we should get a high value at this position */
@@ -793,7 +793,7 @@
false = 0;
f2 = chi2test(data, bits, unify_false_jphide, 0, jphpos[0]);
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
fprintf(stdout, "Pos[0]: %04d[:] %8.5f%%: %8.5f%%\n",
jphpos[0], f2*100, (f2 - f)*100);
@@ -802,13 +802,13 @@
return (0);
f = chi2test(data, bits, unify_jphide, jphpos[0]/2, jphpos[0]);
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
fprintf(stdout, "Pos[0]/2: %04d: %8.5f%%\n", jphpos[0], f*100);
if (f < 0.9)
return (0);
f2 = chi2test(data, bits, unify_false_jphide, jphpos[0]/2, jphpos[0]);
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
fprintf(stdout, "Pos[0]/2: %04d[:] %8.5f%%: %8.5f%%\n",
jphpos[0], f2*100, (f2 - f)*100);
if (f2 * 0.95 > f)
@@ -816,7 +816,7 @@
f = chi2test(data, bits, unify_jphide, 0, jphpos[0]/2);
f2 = chi2test(data, bits, unify_false_jphide, 0, jphpos[0]/2);
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
fprintf(stdout, "0->1/2: %04d[:] %8.5f%% %8.5f%%\n",
jphpos[0], f*100, f2*100);
@@ -864,8 +864,8 @@
else if (f < 0.2)
break;
- if ((debug & DBG_CHI) &&
- ((debug & DBG_PRINTZERO) || f != 0))
+ if ((_debug & DBG_CHI) &&
+ ((_debug & DBG_PRINTZERO) || f != 0))
fprintf(stdout, "%04d: %8.5f%% %8.5f%% %.2f %.2f %s\n",
i, f * 100, f2*100, sum, false,
(i <= jphpos[0] && f2*0.99 > f) ||
@@ -876,7 +876,7 @@
sum /= 1000;
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
fprintf(stdout, "Accumulation (neg = %d, %d): %f%% [%d]\n",
negative, range, sum * 100, jphpos[1]);
@@ -913,7 +913,7 @@
sum += f;
else if (f < 0.2)
break;
- if ((debug & DBG_CHI) && f != 0)
+ if ((_debug & DBG_CHI) && f != 0)
fprintf(stdout, "%04d[:] %8.5f%%\n",
i, f * 100);
}
@@ -939,12 +939,12 @@
else if (f < 0.2)
break;
- if ((debug & DBG_CHI) &&
- ((debug & DBG_PRINTZERO) || f != 0))
+ if ((_debug & DBG_CHI) &&
+ ((_debug & DBG_PRINTZERO) || f != 0))
fprintf(stdout, "%04d: %8.5f%%\n", i, f * 100);
}
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
fprintf(stdout, "Accumulation (%4.0f): %f%%\n",
percent,
sum * 100);
@@ -1277,7 +1277,7 @@
if (jdcts != NULL)
free(jdcts);
scans = 0;
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
fprintf(stdout,
"Disabled by comment check: %d\n",
ncomments);
@@ -1291,7 +1291,7 @@
if (jdcts != NULL)
free(jdcts);
scans = 0;
- if (debug & DBG_ENDVAL)
+ if (_debug & DBG_ENDVAL)
fprintf(stdout,
"Disabled by header check: %d.%d %#0x\n",
major, minor, marker);
@@ -1580,7 +1580,7 @@
detect(line, scans);
}
- if (debug & FLAG_JPHIDESTAT) {
+ if (_debug & FLAG_JPHIDESTAT) {
fprintf(stdout, "Positive rejected because of\n"
"\tRunlength: %d\n"
"\tZero-One: %d\n"
--- stegdetect-0.6/xsteg.c 2010-01-31 20:14:02.437386310 +0100
+++ stegdetect-0.6/xsteg.c 2010-01-31 20:23:00.515636700 +0100
@@ -56,9 +56,6 @@
#define FLAG_DOINVIS 0x0008
#define FLAG_DOF5 0x0010
-extern int (*event_sigcb)(void);
-extern int event_gotsig;
-
struct event start_ev;
struct event gtk_ev;
int quit = 0;
@@ -743,11 +740,6 @@
sigaddset(&set, SIGCHLD);
sigprocmask(SIG_BLOCK, &set, &oldset);
- while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
- if (WIFEXITED(status) || WIFSIGNALED(status))
- event_gotsig = 1;
- }
-
signal(SIGCHLD, chld_handler);
sigemptyset(&set);
@@ -1106,7 +1098,6 @@
gtk_widget_show(window);
event_init();
- event_sigcb = signal_cb;
add_gtk_timeout();
--- stegdetect-0.6/stegdetect.c 2010-01-31 20:35:59.974402726 +0100
+++ stegdetect-0.6/stegdetect.c 2010-01-31 20:36:17.355651655 +0100
@@ -1478,7 +1478,7 @@
fprintf(stdout, "Stegdetect Version %s\n", VERSION);
exit(1);
case 'd':
- debug = atoi(optarg);
+ _debug = atoi(optarg);
break;
case 't':
scans = 0;