mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2025-10-19 10:23:17 +00:00
add Javascript normalizer (not yet enabled)
git-svn: trunk@3917
This commit is contained in:
parent
b0c7e984a8
commit
fd08e02ea3
30 changed files with 2454 additions and 18 deletions
|
@ -1,3 +1,7 @@
|
|||
Mon Jul 7 21:42:18 EEST 2008 (edwin)
|
||||
-------------------------------------
|
||||
* build system, libclamav/jsparse: add Javascript normalizer (not yet enabled)
|
||||
|
||||
Mon Jul 7 15:41:02 CEST 2008 (tk)
|
||||
----------------------------------
|
||||
* libclamav/ole2_extract.c, sigtool: make sigtool compatible with the new
|
||||
|
|
|
@ -150,6 +150,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -132,6 +132,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -117,6 +117,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -137,6 +137,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -126,6 +126,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -119,6 +119,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
28
configure
vendored
28
configure
vendored
|
@ -867,6 +867,7 @@ LIBTOOL
|
|||
VERSIONSCRIPTFLAG
|
||||
VERSIONSCRIPT_TRUE
|
||||
VERSIONSCRIPT_FALSE
|
||||
GPERF
|
||||
LCHECK
|
||||
MAINTAINER_MODE_TRUE
|
||||
MAINTAINER_MODE_FALSE
|
||||
|
@ -4767,7 +4768,7 @@ ia64-*-hpux*)
|
|||
;;
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '#line 4770 "configure"' > conftest.$ac_ext
|
||||
echo '#line 4771 "configure"' > conftest.$ac_ext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -6857,11 +6858,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:6860: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:6861: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:6864: \$? = $ac_status" >&5
|
||||
echo "$as_me:6865: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -7147,11 +7148,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:7150: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:7151: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:7154: \$? = $ac_status" >&5
|
||||
echo "$as_me:7155: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -7251,11 +7252,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:7254: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:7255: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:7258: \$? = $ac_status" >&5
|
||||
echo "$as_me:7259: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -9628,7 +9629,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 9631 "configure"
|
||||
#line 9632 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -9728,7 +9729,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 9731 "configure"
|
||||
#line 9732 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -11570,6 +11571,12 @@ else
|
|||
fi
|
||||
|
||||
|
||||
# it is not fatal if gperf is missing
|
||||
|
||||
GPERF=${GPERF-"${am_missing_run}gperf"}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -20179,6 +20186,7 @@ LIBTOOL!$LIBTOOL$ac_delim
|
|||
VERSIONSCRIPTFLAG!$VERSIONSCRIPTFLAG$ac_delim
|
||||
VERSIONSCRIPT_TRUE!$VERSIONSCRIPT_TRUE$ac_delim
|
||||
VERSIONSCRIPT_FALSE!$VERSIONSCRIPT_FALSE$ac_delim
|
||||
GPERF!$GPERF$ac_delim
|
||||
LCHECK!$LCHECK$ac_delim
|
||||
MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim
|
||||
MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim
|
||||
|
@ -20212,7 +20220,7 @@ LIBOBJS!$LIBOBJS$ac_delim
|
|||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 36; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 37; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
|
|
@ -289,6 +289,10 @@ EOF
|
|||
AC_SUBST([VERSIONSCRIPTFLAG])
|
||||
AM_CONDITIONAL([VERSIONSCRIPT], test "x$ac_cv_ld_version_script" = "xyes")
|
||||
|
||||
# it is not fatal if gperf is missing
|
||||
AM_MISSING_PROG(GPERF, gperf)
|
||||
AC_SUBST(GPERF)
|
||||
|
||||
AC_CHECK_HEADERS([stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h limits.h sys/filio.h sys/uio.h termios.h stdbool.h pwd.h grp.h])
|
||||
AC_CHECK_HEADER([syslog.h],AC_DEFINE([USE_SYSLOG],1,[use syslog]),)
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -101,6 +101,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -94,6 +94,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -122,6 +122,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -188,7 +188,10 @@ libclamav_la_SOURCES = \
|
|||
textnorm.c \
|
||||
textnorm.h \
|
||||
dlp.c \
|
||||
dlp.h
|
||||
dlp.h \
|
||||
jsparse/js-norm.c \
|
||||
jsparse/js-norm.h \
|
||||
jsparse/lexglobal.h
|
||||
|
||||
libclamav_internal_utils_la_SOURCES=str.c \
|
||||
str.h \
|
||||
|
@ -199,4 +202,33 @@ libclamav_internal_utils_la_LDFLAGS=-static
|
|||
libclamav_internal_utils_la_CFLAGS=-DCLI_MEMFUNSONLY
|
||||
lib_LTLIBRARIES = libclamav.la
|
||||
noinst_LTLIBRARIES = libclamav_internal_utils.la
|
||||
EXTRA_DIST = regex/engine.c libclamav.map
|
||||
EXTRA_DIST = regex/engine.c libclamav.map jsparse-keywords.gperf \
|
||||
jsparse-operators.h jsparse-keywords.h jsparse/future_reserved_words\
|
||||
jsparse/keywords jsparse/special_keywords jsparse/operators.gperf
|
||||
|
||||
if MAINTAINER_MODE
|
||||
BUILT_SOURCES=jsparse/generated/operators.h jsparse/generated/keywords.h jsparse-keywords.gperf
|
||||
|
||||
GPERF_FLAGS=-E -t -L ANSI-C -C -F ', TOK_ERROR' -c
|
||||
|
||||
jsparse-keywords.gperf: jsparse/keywords.list jsparse/future_reserved_words.list jsparse/special_keywords.list
|
||||
echo -e "struct keyword { const char *name; int val; };\n%%" >keywords-g-tmp
|
||||
for i in `cat @srcdir@/jsparse/keywords.list`; do j=`echo $$i |tr \[a-z\] \[A-Z\]`; echo "$$i, TOK_$$j" >>keywords-g-tmp; done
|
||||
for i in `cat @srcdir@/jsparse/future_reserved_words.list`; do echo "$$i, TOK_FUTURE_RESERVED_WORD" >>keywords-g-tmp; done
|
||||
cat @srcdir@/jsparse/special_keywords.list >>keywords-g-tmp
|
||||
mv keywords-g-tmp $@
|
||||
|
||||
jsparse/generated/operators.h: jsparse/operators.gperf
|
||||
$(GPERF) $(GPERF_FLAGS) -H op_hash -N in_op_set -W oplist $< >operators-tmp-g
|
||||
grep -v '^#line' <operators-tmp-g | sed -e 's/^const struct/static const struct/' -e 's/register //g' >operators-tmp
|
||||
rm operators-tmp-g
|
||||
mv operators-tmp @srcdir@/jsparse/generated/operators.h
|
||||
|
||||
jsparse/generated/keywords.h: jsparse-keywords.gperf
|
||||
$(GPERF) $(GPERF_FLAGS) $< >keywords-tmp-g
|
||||
grep -v '^#line' <keywords-tmp-g | sed -e 's/^const struct/static const struct/' -e 's/register //g' >keywords-tmp
|
||||
rm keywords-tmp-g
|
||||
mv keywords-tmp @srcdir@/jsparse/generated/keywords.h
|
||||
|
||||
CLEANFILES=jsparse-keywords.gperf @srcdir@/jsparse/generated/operators.h @srcdir@/jsparse/generated/keywords.h
|
||||
endif
|
||||
|
|
|
@ -89,7 +89,7 @@ am_libclamav_la_OBJECTS = matcher-ac.lo matcher-bm.lo matcher.lo \
|
|||
infblock.lo pdf.lo spin.lo yc.lo elf.lo sis.lo uuencode.lo \
|
||||
phishcheck.lo phish_domaincheck_db.lo phish_whitelist.lo \
|
||||
regex_list.lo mspack.lo cab.lo entconv.lo hashtab.lo dconf.lo \
|
||||
lzma_iface.lo explode.lo textnorm.lo dlp.lo
|
||||
lzma_iface.lo explode.lo textnorm.lo dlp.lo js-norm.lo
|
||||
libclamav_la_OBJECTS = $(am_libclamav_la_OBJECTS)
|
||||
libclamav_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
|
@ -165,6 +165,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
@ -423,7 +424,10 @@ libclamav_la_SOURCES = \
|
|||
textnorm.c \
|
||||
textnorm.h \
|
||||
dlp.c \
|
||||
dlp.h
|
||||
dlp.h \
|
||||
jsparse/js-norm.c \
|
||||
jsparse/js-norm.h \
|
||||
jsparse/lexglobal.h
|
||||
|
||||
libclamav_internal_utils_la_SOURCES = str.c \
|
||||
str.h \
|
||||
|
@ -434,8 +438,15 @@ libclamav_internal_utils_la_LDFLAGS = -static
|
|||
libclamav_internal_utils_la_CFLAGS = -DCLI_MEMFUNSONLY
|
||||
lib_LTLIBRARIES = libclamav.la
|
||||
noinst_LTLIBRARIES = libclamav_internal_utils.la
|
||||
EXTRA_DIST = regex/engine.c libclamav.map
|
||||
all: all-recursive
|
||||
EXTRA_DIST = regex/engine.c libclamav.map jsparse-keywords.gperf \
|
||||
jsparse-operators.h jsparse-keywords.h jsparse/future_reserved_words\
|
||||
jsparse/keywords jsparse/special_keywords jsparse/operators.gperf
|
||||
|
||||
@MAINTAINER_MODE_TRUE@BUILT_SOURCES = jsparse/generated/operators.h jsparse/generated/keywords.h jsparse-keywords.gperf
|
||||
@MAINTAINER_MODE_TRUE@GPERF_FLAGS = -E -t -L ANSI-C -C -F ', TOK_ERROR' -c
|
||||
@MAINTAINER_MODE_TRUE@CLEANFILES = jsparse-keywords.gperf @srcdir@/jsparse/generated/operators.h @srcdir@/jsparse/generated/keywords.h
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
|
@ -536,6 +547,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infblock.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inflate64.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_tar.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/js-norm.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclamav_internal_utils_la-others.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclamav_internal_utils_la-str.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line.Plo@am__quote@
|
||||
|
@ -666,6 +678,13 @@ infblock.lo: nsis/infblock.c
|
|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o infblock.lo `test -f 'nsis/infblock.c' || echo '$(srcdir)/'`nsis/infblock.c
|
||||
|
||||
js-norm.lo: jsparse/js-norm.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT js-norm.lo -MD -MP -MF $(DEPDIR)/js-norm.Tpo -c -o js-norm.lo `test -f 'jsparse/js-norm.c' || echo '$(srcdir)/'`jsparse/js-norm.c
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/js-norm.Tpo $(DEPDIR)/js-norm.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jsparse/js-norm.c' object='js-norm.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o js-norm.lo `test -f 'jsparse/js-norm.c' || echo '$(srcdir)/'`jsparse/js-norm.c
|
||||
|
||||
libclamav_internal_utils_la-str.lo: str.c
|
||||
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libclamav_internal_utils_la_CFLAGS) $(CFLAGS) -MT libclamav_internal_utils_la-str.lo -MD -MP -MF $(DEPDIR)/libclamav_internal_utils_la-str.Tpo -c -o libclamav_internal_utils_la-str.lo `test -f 'str.c' || echo '$(srcdir)/'`str.c
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libclamav_internal_utils_la-str.Tpo $(DEPDIR)/libclamav_internal_utils_la-str.Plo
|
||||
|
@ -877,14 +896,16 @@ distdir: $(DISTFILES)
|
|||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
check: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-recursive
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-recursive
|
||||
install: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
@ -901,6 +922,7 @@ install-strip:
|
|||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
@ -908,6 +930,7 @@ distclean-generic:
|
|||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
||||
|
@ -987,6 +1010,25 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
|
|||
tags tags-recursive uninstall uninstall-am \
|
||||
uninstall-includeHEADERS uninstall-libLTLIBRARIES
|
||||
|
||||
|
||||
@MAINTAINER_MODE_TRUE@jsparse-keywords.gperf: jsparse/keywords.list jsparse/future_reserved_words.list jsparse/special_keywords.list
|
||||
@MAINTAINER_MODE_TRUE@ echo -e "struct keyword { const char *name; int val; };\n%%" >keywords-g-tmp
|
||||
@MAINTAINER_MODE_TRUE@ for i in `cat @srcdir@/jsparse/keywords.list`; do j=`echo $$i |tr \[a-z\] \[A-Z\]`; echo "$$i, TOK_$$j" >>keywords-g-tmp; done
|
||||
@MAINTAINER_MODE_TRUE@ for i in `cat @srcdir@/jsparse/future_reserved_words.list`; do echo "$$i, TOK_FUTURE_RESERVED_WORD" >>keywords-g-tmp; done
|
||||
@MAINTAINER_MODE_TRUE@ cat @srcdir@/jsparse/special_keywords.list >>keywords-g-tmp
|
||||
@MAINTAINER_MODE_TRUE@ mv keywords-g-tmp $@
|
||||
|
||||
@MAINTAINER_MODE_TRUE@jsparse/generated/operators.h: jsparse/operators.gperf
|
||||
@MAINTAINER_MODE_TRUE@ $(GPERF) $(GPERF_FLAGS) -H op_hash -N in_op_set -W oplist $< >operators-tmp-g
|
||||
@MAINTAINER_MODE_TRUE@ grep -v '^#line' <operators-tmp-g | sed -e 's/^const struct/static const struct/' -e 's/register //g' >operators-tmp
|
||||
@MAINTAINER_MODE_TRUE@ rm operators-tmp-g
|
||||
@MAINTAINER_MODE_TRUE@ mv operators-tmp @srcdir@/jsparse/generated/operators.h
|
||||
|
||||
@MAINTAINER_MODE_TRUE@jsparse/generated/keywords.h: jsparse-keywords.gperf
|
||||
@MAINTAINER_MODE_TRUE@ $(GPERF) $(GPERF_FLAGS) $< >keywords-tmp-g
|
||||
@MAINTAINER_MODE_TRUE@ grep -v '^#line' <keywords-tmp-g | sed -e 's/^const struct/static const struct/' -e 's/register //g' >keywords-tmp
|
||||
@MAINTAINER_MODE_TRUE@ rm keywords-tmp-g
|
||||
@MAINTAINER_MODE_TRUE@ mv keywords-tmp @srcdir@/jsparse/generated/keywords.h
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
|
31
libclamav/jsparse/future_reserved_words.list
Normal file
31
libclamav/jsparse/future_reserved_words.list
Normal file
|
@ -0,0 +1,31 @@
|
|||
abstract
|
||||
boolean
|
||||
byte
|
||||
char
|
||||
class
|
||||
const
|
||||
debugger
|
||||
double
|
||||
enum
|
||||
export
|
||||
extends
|
||||
final
|
||||
float
|
||||
goto
|
||||
implements
|
||||
import
|
||||
int
|
||||
interface
|
||||
long
|
||||
native
|
||||
package
|
||||
private
|
||||
protected
|
||||
public
|
||||
short
|
||||
static
|
||||
super
|
||||
synchronized
|
||||
throws
|
||||
transient
|
||||
volatile
|
194
libclamav/jsparse/generated/keywords.h
Normal file
194
libclamav/jsparse/generated/keywords.h
Normal file
|
@ -0,0 +1,194 @@
|
|||
/* ANSI-C code produced by gperf version 3.0.3 */
|
||||
/* Command-line: gperf -E -t -L ANSI-C -C -F ', TOK_ERROR' -c jsparse-keywords.gperf */
|
||||
/* Computed positions: -k'1-2' */
|
||||
|
||||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
|
||||
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
|
||||
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
|
||||
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
|
||||
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
|
||||
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
|
||||
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
|
||||
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
|
||||
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
|
||||
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
|
||||
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
|
||||
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
|
||||
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
|
||||
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
|
||||
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
|
||||
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
|
||||
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
|
||||
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
|
||||
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
|
||||
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
|
||||
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
|
||||
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
|
||||
/* The character set is not based on ISO-646. */
|
||||
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
|
||||
#endif
|
||||
|
||||
struct keyword { const char *name; int val; };
|
||||
/* maximum key range = 100, duplicates = 0 */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static unsigned int
|
||||
hash (const char *str, unsigned int len)
|
||||
{
|
||||
static const unsigned char asso_values[] =
|
||||
{
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 30, 5, 0,
|
||||
5, 0, 10, 50, 35, 5, 103, 103, 25, 55,
|
||||
0, 20, 35, 103, 0, 40, 15, 5, 45, 55,
|
||||
45, 50, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
|
||||
103, 103, 103, 103, 103, 103
|
||||
};
|
||||
return len + asso_values[(unsigned char)str[1]] + asso_values[(unsigned char)str[0]];
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#ifdef __GNUC_STDC_INLINE__
|
||||
__attribute__ ((__gnu_inline__))
|
||||
#endif
|
||||
#endif
|
||||
static const struct keyword *
|
||||
in_word_set (const char *str, unsigned int len)
|
||||
{
|
||||
enum
|
||||
{
|
||||
TOTAL_KEYWORDS = 59,
|
||||
MIN_WORD_LENGTH = 2,
|
||||
MAX_WORD_LENGTH = 12,
|
||||
MIN_HASH_VALUE = 3,
|
||||
MAX_HASH_VALUE = 102
|
||||
};
|
||||
|
||||
static const struct keyword wordlist[] =
|
||||
{
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"new", TOK_NEW},
|
||||
{"enum", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR},
|
||||
{"return", TOK_RETURN},
|
||||
{"in", TOK_IN},
|
||||
{"int", TOK_FUTURE_RESERVED_WORD},
|
||||
{"null", TOK_NULL},
|
||||
{"break", TOK_BREAK},
|
||||
{"delete", TOK_DELETE},
|
||||
{"default", TOK_DEFAULT},
|
||||
{"debugger", TOK_FUTURE_RESERVED_WORD},
|
||||
{"interface", TOK_FUTURE_RESERVED_WORD},
|
||||
{"instanceof", TOK_INSTANCEOF},
|
||||
{"", TOK_ERROR},
|
||||
{"if", TOK_IF},
|
||||
{"try", TOK_TRY},
|
||||
{"true", TOK_TRUE},
|
||||
{"final", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR},
|
||||
{"finally", TOK_FINALLY},
|
||||
{"function", TOK_FUNCTION},
|
||||
{"transient", TOK_FUTURE_RESERVED_WORD},
|
||||
{"const", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR},
|
||||
{"do", TOK_DO},
|
||||
{"continue", TOK_CONTINUE},
|
||||
{"else", TOK_ELSE},
|
||||
{"class", TOK_FUTURE_RESERVED_WORD},
|
||||
{"double", TOK_FUTURE_RESERVED_WORD},
|
||||
{"boolean", TOK_FUTURE_RESERVED_WORD},
|
||||
{"for", TOK_FOR},
|
||||
{"case", TOK_CASE},
|
||||
{"catch", TOK_CATCH},
|
||||
{"native", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"char", TOK_FUTURE_RESERVED_WORD},
|
||||
{"float", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR},
|
||||
{"private", TOK_FUTURE_RESERVED_WORD},
|
||||
{"abstract", TOK_FUTURE_RESERVED_WORD},
|
||||
{"protected", TOK_FUTURE_RESERVED_WORD},
|
||||
{"false", TOK_FALSE},
|
||||
{"public", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"long", TOK_FUTURE_RESERVED_WORD},
|
||||
{"super", TOK_FUTURE_RESERVED_WORD},
|
||||
{"export", TOK_FUTURE_RESERVED_WORD},
|
||||
{"extends", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR},
|
||||
{"this", TOK_THIS},
|
||||
{"throw", TOK_THROW},
|
||||
{"throws", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"byte", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR},
|
||||
{"static", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"with", TOK_WITH},
|
||||
{"", TOK_ERROR},
|
||||
{"import", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"void", TOK_VOID},
|
||||
{"implements", TOK_FUTURE_RESERVED_WORD},
|
||||
{"typeof", TOK_TYPEOF},
|
||||
{"package", TOK_FUTURE_RESERVED_WORD},
|
||||
{"volatile", TOK_FUTURE_RESERVED_WORD},
|
||||
{"goto", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"var", TOK_VAR},
|
||||
{"", TOK_ERROR},
|
||||
{"short", TOK_FUTURE_RESERVED_WORD},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"while", TOK_WHILE},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"switch", TOK_SWITCH},
|
||||
{"synchronized", TOK_FUTURE_RESERVED_WORD}
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
int key = hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
const char *s = wordlist[key].name;
|
||||
|
||||
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
|
||||
return &wordlist[key];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
186
libclamav/jsparse/generated/operators.h
Normal file
186
libclamav/jsparse/generated/operators.h
Normal file
|
@ -0,0 +1,186 @@
|
|||
/* ANSI-C code produced by gperf version 3.0.3 */
|
||||
/* Command-line: gperf -E -t -L ANSI-C -C -F ', TOK_ERROR' -c -H op_hash -N in_op_set -W oplist ../../../trunk/libclamav/jsparse/operators.gperf */
|
||||
/* Computed positions: -k'1,$' */
|
||||
|
||||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
|
||||
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
|
||||
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
|
||||
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
|
||||
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
|
||||
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
|
||||
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
|
||||
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
|
||||
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
|
||||
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
|
||||
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
|
||||
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
|
||||
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
|
||||
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
|
||||
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
|
||||
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
|
||||
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
|
||||
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
|
||||
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
|
||||
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
|
||||
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
|
||||
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
|
||||
/* The character set is not based on ISO-646. */
|
||||
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
|
||||
#endif
|
||||
|
||||
struct operator {
|
||||
const char *name;
|
||||
int val;
|
||||
};
|
||||
/* maximum key range = 121, duplicates = 0 */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static unsigned int
|
||||
op_hash (const char *str, unsigned int len)
|
||||
{
|
||||
static const unsigned char asso_values[] =
|
||||
{
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 50, 122, 122, 122, 31, 40, 122,
|
||||
122, 122, 21, 30, 122, 25, 122, 16, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 45, 122,
|
||||
10, 5, 0, 35, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 60, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 20, 122, 15, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
|
||||
122, 122, 122, 122, 122, 122
|
||||
};
|
||||
return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#ifdef __GNUC_STDC_INLINE__
|
||||
__attribute__ ((__gnu_inline__))
|
||||
#endif
|
||||
#endif
|
||||
static const struct operator *
|
||||
in_op_set (const char *str, unsigned int len)
|
||||
{
|
||||
enum
|
||||
{
|
||||
TOTAL_KEYWORDS = 39,
|
||||
MIN_WORD_LENGTH = 1,
|
||||
MAX_WORD_LENGTH = 4,
|
||||
MIN_HASH_VALUE = 1,
|
||||
MAX_HASH_VALUE = 121
|
||||
};
|
||||
|
||||
static const struct operator oplist[] =
|
||||
{
|
||||
{"", TOK_ERROR},
|
||||
{">", TOK_GREATER},
|
||||
{">>", TOK_SHIFT_RIGHT},
|
||||
{">>>", TOK_DOUBLESHIFT_RIGHT},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{">=", TOK_GREATEREQUAL},
|
||||
{">>=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
|
||||
{">>>=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
|
||||
{"", TOK_ERROR},
|
||||
{"=", TOK_EQUAL},
|
||||
{"==", TOK_EQUAL_EQUAL},
|
||||
{"===", TOK_TRIPLE_EQUAL},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"<=", TOK_LESSEQUAL},
|
||||
{"<<=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"<", TOK_LESS},
|
||||
{"<<", TOK_SHIFT_LEFT},
|
||||
{"/=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"|=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
|
||||
{"*=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"~", TOK_TILDE},
|
||||
{"-=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
|
||||
{"/", TOK_DIVIDE},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"+=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
|
||||
{"%=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"|", TOK_OR},
|
||||
{"||", TOK_OR_OR},
|
||||
{"*", TOK_MULTIPLY},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"&=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"-", TOK_MINUS},
|
||||
{"--", TOK_MINUSMINUS},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR},
|
||||
{"!=", TOK_NOT_EQUAL},
|
||||
{"!==", TOK_NOT_DOUBLEEQUAL},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"+", TOK_PLUS},
|
||||
{"++", TOK_PLUSPLUS},
|
||||
{"%", TOK_PERCENT},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"^=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"?", TOK_QUESTIONMARK},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"&", TOK_AND},
|
||||
{"&&", TOK_AND_AND},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{":", TOK_COLON},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"!", TOK_EXCLAMATION},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
|
||||
{"", TOK_ERROR},
|
||||
{"^", TOK_XOR}
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
int key = op_hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
const char *s = oplist[key].name;
|
||||
|
||||
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
|
||||
return &oplist[key];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
1672
libclamav/jsparse/js-norm.c
Normal file
1672
libclamav/jsparse/js-norm.c
Normal file
File diff suppressed because it is too large
Load diff
29
libclamav/jsparse/js-norm.h
Normal file
29
libclamav/jsparse/js-norm.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Javascript normalizer.
|
||||
*
|
||||
* Copyright (C) 2008 Sourcefire, Inc.
|
||||
*
|
||||
* Authors: Török Edvin
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
struct parser_state;
|
||||
int cli_js_init(struct parser_state *state);
|
||||
void cli_js_process_buffer(struct parser_state *state, const char *buf, size_t n);
|
||||
void cli_js_parse_done(struct parser_state* state);
|
||||
void cli_js_output(struct parser_state *state);
|
||||
void cli_js_destroy(struct parser_state *state);
|
||||
|
25
libclamav/jsparse/keywords.list
Normal file
25
libclamav/jsparse/keywords.list
Normal file
|
@ -0,0 +1,25 @@
|
|||
break
|
||||
case
|
||||
catch
|
||||
continue
|
||||
default
|
||||
delete
|
||||
do
|
||||
else
|
||||
finally
|
||||
for
|
||||
function
|
||||
if
|
||||
in
|
||||
instanceof
|
||||
new
|
||||
return
|
||||
switch
|
||||
this
|
||||
throw
|
||||
try
|
||||
typeof
|
||||
var
|
||||
void
|
||||
while
|
||||
with
|
146
libclamav/jsparse/lexglobal.h
Normal file
146
libclamav/jsparse/lexglobal.h
Normal file
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Javascript normalizer.
|
||||
*
|
||||
* Copyright (C) 2008 Sourcefire, Inc.
|
||||
*
|
||||
* Authors: Török Edvin
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef YYSTYPE
|
||||
enum token_type {
|
||||
TOK_FUTURE_RESERVED_WORD=1,
|
||||
TOK_ERROR,
|
||||
TOK_IDENTIFIER_NAME,
|
||||
TOK_TRUE,
|
||||
TOK_FALSE,
|
||||
TOK_NULL,
|
||||
TOK_BRACKET_OPEN,
|
||||
TOK_BRACKET_CLOSE,
|
||||
TOK_COMMA,
|
||||
TOK_CURLY_BRACE_OPEN,
|
||||
TOK_CURLY_BRACE_CLOSE,
|
||||
TOK_PAR_OPEN,
|
||||
TOK_PAR_CLOSE,
|
||||
TOK_DOT,
|
||||
TOK_SEMICOLON,
|
||||
TOK_COLON,
|
||||
TOK_NEW,
|
||||
TOK_NumericInt,
|
||||
TOK_NumericFloat,
|
||||
TOK_StringLiteral,
|
||||
TOK_REGULAR_EXPRESSION_LITERAL,
|
||||
TOK_THIS,
|
||||
TOK_PLUSPLUS,
|
||||
TOK_MINUSMINUS,
|
||||
TOK_DELETE,
|
||||
TOK_VOID,
|
||||
TOK_TYPEOF,
|
||||
TOK_MINUS,
|
||||
TOK_TILDE,
|
||||
TOK_EXCLAMATION,
|
||||
TOK_MULTIPLY,
|
||||
TOK_DIVIDE,
|
||||
TOK_PERCENT,
|
||||
TOK_PLUS,
|
||||
TOK_SHIFT_LEFT,
|
||||
TOK_SHIFT_RIGHT,
|
||||
TOK_DOUBLESHIFT_RIGHT,
|
||||
TOK_LESS,
|
||||
TOK_GREATER,
|
||||
TOK_LESSEQUAL,
|
||||
TOK_GREATEREQUAL,
|
||||
TOK_INSTANCEOF,
|
||||
TOK_IN,
|
||||
TOK_EQUAL_EQUAL,
|
||||
TOK_NOT_EQUAL,
|
||||
TOK_TRIPLE_EQUAL,
|
||||
TOK_NOT_DOUBLEEQUAL,
|
||||
TOK_AND,
|
||||
TOK_XOR,
|
||||
TOK_OR,
|
||||
TOK_AND_AND,
|
||||
TOK_OR_OR,
|
||||
TOK_QUESTIONMARK,
|
||||
TOK_EQUAL,
|
||||
TOK_ASSIGNMENT_OPERATOR_NOEQUAL,
|
||||
TOK_VAR,
|
||||
TOK_IF,
|
||||
TOK_ELSE,
|
||||
TOK_DO,
|
||||
TOK_WHILE,
|
||||
TOK_FOR,
|
||||
TOK_CONTINUE,
|
||||
TOK_BREAK,
|
||||
TOK_RETURN,
|
||||
TOK_WITH,
|
||||
TOK_SWITCH,
|
||||
TOK_CASE,
|
||||
TOK_DEFAULT,
|
||||
TOK_THROW,
|
||||
TOK_TRY,
|
||||
TOK_CATCH,
|
||||
TOK_FINALLY,
|
||||
TOK_FUNCTION,
|
||||
TOK_UNNORM_IDENTIFIER
|
||||
};
|
||||
|
||||
enum val_type {
|
||||
vtype_undefined,
|
||||
vtype_cstring,
|
||||
vtype_string,
|
||||
vtype_scope,
|
||||
vtype_dval,
|
||||
vtype_ival
|
||||
};
|
||||
|
||||
typedef struct token {
|
||||
union {
|
||||
const char *cstring;
|
||||
char *string;
|
||||
struct scope *scope;/* for function */
|
||||
double dval;
|
||||
long ival;
|
||||
} val;
|
||||
enum token_type type;
|
||||
enum val_type vtype;
|
||||
} yystype;
|
||||
|
||||
/* inline functions to access the structure to ensure type safety */
|
||||
|
||||
#define TOKEN_SET(DST, VTYPE, VAL) do {\
|
||||
(DST)->vtype = vtype_##VTYPE ; (DST)->val.VTYPE = (VAL); \
|
||||
} while(0);
|
||||
|
||||
#define cstring_invalid NULL
|
||||
#define string_invalid NULL
|
||||
#define scope_invalid NULL
|
||||
/* there isn't really an invalid double, or long value, but we don't care
|
||||
* about those values anyway, so -1 will be fine here */
|
||||
#define dval_invalid -1
|
||||
#define ival_invalid -1
|
||||
|
||||
/* compatible if same type, or if we request a const char* instead of char*,
|
||||
* but not viceversa! */
|
||||
static int vtype_compatible(enum val_type orig, enum val_type req)
|
||||
{
|
||||
return orig == req || (orig == vtype_string && req == vtype_cstring);
|
||||
}
|
||||
#define COMPATIBLE(SRC, VTYPE) ((SRC)->vtype == vtype_##VTYPE || )
|
||||
|
||||
#define TOKEN_GET(SRC, VTYPE) (vtype_compatible((SRC)->vtype, vtype_##VTYPE) ? (SRC)->val.VTYPE : VTYPE##_invalid)
|
||||
|
||||
#define YYSTYPE yystype
|
||||
#endif
|
44
libclamav/jsparse/operators.gperf
Normal file
44
libclamav/jsparse/operators.gperf
Normal file
|
@ -0,0 +1,44 @@
|
|||
struct operator {
|
||||
const char *name;
|
||||
int val;
|
||||
};
|
||||
%%
|
||||
=, TOK_EQUAL
|
||||
+, TOK_PLUS
|
||||
===, TOK_TRIPLE_EQUAL
|
||||
>>>, TOK_DOUBLESHIFT_RIGHT
|
||||
!==, TOK_NOT_DOUBLEEQUAL
|
||||
<<, TOK_SHIFT_LEFT
|
||||
<=, TOK_LESSEQUAL
|
||||
==, TOK_EQUAL_EQUAL
|
||||
>=, TOK_GREATEREQUAL
|
||||
>>, TOK_SHIFT_RIGHT
|
||||
||, TOK_OR_OR
|
||||
--, TOK_MINUSMINUS
|
||||
!=, TOK_NOT_EQUAL
|
||||
&&, TOK_AND_AND
|
||||
++, TOK_PLUSPLUS
|
||||
*=, TOK_ASSIGNMENT_OPERATOR_NOEQUAL
|
||||
/=, TOK_ASSIGNMENT_OPERATOR_NOEQUAL
|
||||
"%=", TOK_ASSIGNMENT_OPERATOR_NOEQUAL
|
||||
+=, TOK_ASSIGNMENT_OPERATOR_NOEQUAL
|
||||
-=, TOK_ASSIGNMENT_OPERATOR_NOEQUAL
|
||||
<<=, TOK_ASSIGNMENT_OPERATOR_NOEQUAL
|
||||
>>=, TOK_ASSIGNMENT_OPERATOR_NOEQUAL
|
||||
>>>=, TOK_ASSIGNMENT_OPERATOR_NOEQUAL
|
||||
&=, TOK_ASSIGNMENT_OPERATOR_NOEQUAL
|
||||
^=, TOK_ASSIGNMENT_OPERATOR_NOEQUAL
|
||||
|=, TOK_ASSIGNMENT_OPERATOR_NOEQUAL
|
||||
&, TOK_AND
|
||||
:, TOK_COLON
|
||||
/, TOK_DIVIDE
|
||||
!, TOK_EXCLAMATION
|
||||
>, TOK_GREATER
|
||||
<, TOK_LESS
|
||||
-, TOK_MINUS
|
||||
*, TOK_MULTIPLY
|
||||
|, TOK_OR
|
||||
"%", TOK_PERCENT
|
||||
?, TOK_QUESTIONMARK
|
||||
~, TOK_TILDE
|
||||
^, TOK_XOR
|
3
libclamav/jsparse/special_keywords.list
Normal file
3
libclamav/jsparse/special_keywords.list
Normal file
|
@ -0,0 +1,3 @@
|
|||
null, TOK_NULL
|
||||
true, TOK_TRUE
|
||||
false, TOK_FALSE
|
|
@ -114,6 +114,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -118,6 +118,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -113,6 +113,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -121,6 +121,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -76,6 +76,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
|
@ -102,6 +102,7 @@ EGREP = @EGREP@
|
|||
EXEEXT = @EXEEXT@
|
||||
FRESHCLAM_LIBS = @FRESHCLAM_LIBS@
|
||||
GETENT = @GETENT@
|
||||
GPERF = @GPERF@
|
||||
GREP = @GREP@
|
||||
HAVE_LIBGMP = @HAVE_LIBGMP@
|
||||
INSTALL = @INSTALL@
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue