aboutsummaryrefslogtreecommitdiffstats
path: root/epan/sigcomp-udvm.c
AgeCommit message (Collapse)AuthorFilesLines
2015-01-20Move all SigComp functionality to the SigComp dissector.Michael Mann1-3223/+0
While it does make packet-sigcomp.c much bigger, there's no reason for it to be in epan directory. Change-Id: I2d78c32de1d56e76578e610d4df586b5610d1b49 Reviewed-on: https://code.wireshark.org/review/6682 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-18Remove some apparently-unnecessary includes of emem.h.Guy Harris1-2/+0
Change-Id: Ib7d1b587b439ff21ec6b7f1756ce6ccf25b66f80 Reviewed-on: https://code.wireshark.org/review/6635 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-08Replace some ep_alloc and ep_alloc0 with its wmem equivalent.Michael Mann1-1/+1
These cases were pretty easy to identify. Also replaced some comments that referenced ep_alloced memory, when it's now in fact wmem_alloced. Change-Id: I07d2f390a9c0b34aa2956880476755d1acf5db0a Reviewed-on: https://code.wireshark.org/review/6392 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-08bytes_to_ep_str -> bytes_to_strMichael Mann1-3/+3
Change-Id: Ifcda8328dedec0ef4104c3a124d6246f99493750 Reviewed-on: https://code.wireshark.org/review/6389 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-11-05sigcomp-udvm: fix invalid accessEvan Huus1-1/+1
Way back in 2006, svn r20041 (now gd408f2f6fc) worked around a problem by limiting the amount of buffer dealt with in the udvm_state_access call (changing it from state_minimum_access_length_buff[n] to STATE_MIN_ACCESS_LEN). The very next line however, tries to read the same amount of buffer to display to the user - since it seems nobody ever applied a proper fix for the original case, just apply the same workaround to the second call. Bug: 10662 Change-Id: I32c81ee2a8eb7b30ff7ab1fbbb6ea5f206385d4b Reviewed-on: https://code.wireshark.org/review/5124 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-10-30temporary workaround to stop the fuzz failuresMartin Kaiser1-2/+2
Bug: 10635 Change-Id: I2132119710392e077f74c92e737e4edce4fcc295 Reviewed-on: https://code.wireshark.org/review/5011 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-07-08udvm: free the buffer *before* throwing the exceptionEvan Huus1-3/+16
Freeing it after the exception doesn't do much, for obvious reasons. Also move the allocation a bit later, and add modelines. This fixes one major memory leak, although on inspection this code still isn't safe since there are exception-throwing functions called all over the place with glib memory active. Outside the scope of this fix though. Bug: 10265 Change-Id: I1fe272e92b92cac6b99abb84866b8ae9b582e24c Reviewed-on: https://code.wireshark.org/review/2931 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-06sigcomp: Add buffer check to STATE-ACCESSPeter Wu1-0/+1
Two conditions were not checked, state_length == 0 && state_begin != 0 and the boundaries of the state buffer. The former is not a big deal, but the second issue causes a buffer overrun (detected by ASAN). The buffer size is supposed to be stored in the state buffer, that was not the case for the initial two SIP SDP and Presence state buffers. Fix a typo for presence_buf zero-ing while at it. Bug: 9601 Change-Id: I41dde83185da60b670cca010ecc7b2a2aaaedeb9 Reviewed-on: https://code.wireshark.org/review/1529 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2013-12-19Rename a couple of to_str functions to have ep_ in the name. This makes itEvan Huus1-3/+3
obvious that the returned string is ephemeral, and opens up the original names in the API for versions that take a wmem pool (and thus can work in any scope). svn path=/trunk/; revision=54249
2013-11-10Add missing includes in order to remove exceptions.h from proto.h (next commit).Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53230
2013-11-10Move prototype of bytes_to_str, bytes_to_str_punct to correct header.Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53214
2013-09-13Explicitly include emem.h where it is neededJörg Mayer1-0/+2
svn path=/trunk/; revision=51997
2013-08-01Move a bunch of the crypt modules and pint.h into wsutil.Jeff Morriss1-3/+4
This means wsutil now links against libcrypt. Protect a bunch of the crypt header files from multiple inclusion. svn path=/trunk/; revision=51100
2013-04-22Fix some Dead Store (Dead assignement/Dead increment) Warning found by ClangAlexis La Goutte1-8/+3
svn path=/trunk/; revision=48989
2013-03-20 From beroset:Bill Meier1-3/+3
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397 svn path=/trunk/; revision=48438
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45016
2012-06-28Update FSF address - part II.Jakub Zawadzki1-1/+1
svn path=/trunk/; revision=43538
2012-05-07From Evan Huus:Bill Meier1-5/+0
CppCheck found a bunch of redundant assignments to the variable 'operand_address'. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7232 svn path=/trunk/; revision=42457
2012-01-15Rename crypt-xxx to xxxJörg Mayer1-1/+1
svn path=/trunk/; revision=40511
2011-08-31Second try to move crc routines to libwsutil.Stig Bjørlykke1-1/+1
This time keep the tvb routines in epan. Now we can use common crc routines outside epan. svn path=/trunk/; revision=38810
2011-08-30Revert r38800, as the crc routines contains some tvb functions.Stig Bjørlykke1-1/+1
svn path=/trunk/; revision=38803
2011-08-30Move all crc routines to libwsutil.Stig Bjørlykke1-1/+1
This way we can use the crc routines in wiretap. svn path=/trunk/; revision=38800
2011-06-07Fix gcc 4.6 "set but not used [-Wunused-but-set-variable]" warningsBill Meier1-3/+3
svn path=/trunk/; revision=37600
2010-06-25Make sure our addresses are modulo 2^16 in a lot of places. Fixes aGerald Combs1-31/+33
crash found while fuzzing, and hopefully fixes bug 4867. In sigcomp_init_udvm() initialize the first 8 bytes of our buffers, which squelches a valgrind complaint. svn path=/trunk/; revision=33321
2010-06-04Fix comments.Guy Harris1-2/+2
svn path=/trunk/; revision=33090
2010-06-04According to RFC 3220 section 7 the max UDVM message size is 65536,Gerald Combs1-1/+1
not 65535. Hopefully fixes bug 4837. svn path=/trunk/; revision=33087
2010-06-03Sorry, I forgot that 8.6. UDVM Cycles saysGuy Harris1-1/+0
Note that the number of UDVM cycles MUST NOT be increased if a request for additional compressed data fails. so we *shouldn't* increase the cycle count further when SIGCOMP_INSTR_INPUT_BYTES fails. That does *NOT* of course, mean that we shouldn't increase the cycle count by 1 for a failed INPUT-BYTES instruction - that would leave UDVM vulnerable to infinite loops (as per bug 4826), and I *really* doubt that was their intent; presumably, it means it should not be increased *by the number of cycles for the additional data*: Additionally, if the UDVM successfully requests n bits of compressed data using one of the INPUT instructions then the number of available UDVM cycles is increased by n * cycles_per_bit once the instruction has been executed. if the attempt to get that additional data fails. svn path=/trunk/; revision=33065
2010-06-02Increment the cycle count no matter what. Increase the cycle countGerald Combs1-35/+16
further when SIGCOMP_INSTR_INPUT_BYTES fails. Fixes the infinite loop found in bug 4826. svn path=/trunk/; revision=33061
2010-01-28Fix various gcc -Wshadow warnings.Bill Meier1-34/+34
svn path=/trunk/; revision=31720
2009-10-05Allocate 64K buffer from heapKovarththanan Rajaratnam1-7/+2
svn path=/trunk/; revision=30339
2009-09-29Print correct destination for SIGCOMP_INSTR_COPY_LITERAL.Stig Bjørlykke1-1/+1
svn path=/trunk/; revision=30206
2009-05-14Apply some of the patches from:Anders Broman1-4/+2
http://wiki.wireshark.org/Development/Optimization svn path=/trunk/; revision=28365
2008-12-20Fix some typos and spelling (mostly in text strings)Bill Meier1-3/+3
svn path=/trunk/; revision=27068
2007-03-28Remove almost all of the casts I committed recently and in place ofStephen Fisher1-2/+2
them, add -Wno-pointer-sign to CFLAGS when gcc will accept it. svn path=/trunk/; revision=21253
2007-03-26Fix a bunch more warnings. Add -Werror when using --with-warnings-as-errorsStephen Fisher1-2/+2
under gcc to tools/lemon, plugins/mate and epan/ svn path=/trunk/; revision=21204
2007-01-12Move sha1.[ch] to epan/crypt/crypt-sha1.[ch]. Remove duplicate code.Gerald Combs1-156/+156
svn path=/trunk/; revision=20399
2006-12-05From Cristian Constantin:Anders Broman1-0/+5
As a workarond for the problem that accsessing a state with a state id > the stored minimum access length fail, only store and compare the state with the minimum access lengt specified in the standard of 6 bytes. svn path=/trunk/; revision=20041
2006-05-28Ethereal->WiresharkAnders Broman1-1/+1
svn path=/trunk/; revision=18234
2006-05-21name changeRonnie Sahlberg1-2/+2
svn path=/trunk/; revision=18197
2006-03-07Fix a bug reported by coverity.Anders Broman1-1/+2
svn path=/trunk/; revision=17490
2006-01-05Bill Meier:Jörg Mayer1-2/+2
Spelling fixes. svn path=/trunk/; revision=16956
2005-09-21I think this is the check that was intended....Guy Harris1-1/+1
svn path=/trunk/; revision=15919
2005-09-20Be more paranoid about buffer overruns.Gerald Combs1-7/+37
svn path=/trunk/; revision=15901
2005-09-19Throw an exception instead of trying to read past the end of a buffer.Gerald Combs1-0/+5
Fixes bug 455. svn path=/trunk/; revision=15876
2005-09-07Add bounds checking in several places to the SigComp UDVM. Use memset()Gerald Combs1-12/+7
instead of while loops to initialize variables. Use a define instead of magic numbers. Don't use guint8s for counters. Add a corresponding entry to the release notes. svn path=/trunk/; revision=15715
2005-08-31udvm: initialise a variableAnders Broman1-2/+2
sigcomp: implement RFC 4077 svn path=/trunk/; revision=15640
2005-08-25From Timo MetsalaAnders Broman1-9/+112
Changes: o Implemented CRC and SHA-1 (sort operations are still missing) o After state acccess, the execution start is not necessarily the beginning of the bytecode; start IP is now a new parameter to decompress_sigcomp_message() o Removed some hard-coded assumptions about bytecode starting at offset 128 svn path=/trunk/; revision=15531
2005-08-08various code cleanup:Ulf Lamping1-4/+0
-use g_snprintf instead of sprintf and snprintf -use g_strdup_printf where appropriate -remove #include "snprintf.h" (as only g_snprintf should be used) -replace some more alloc/realloc/calloc/free with their glib pendants svn path=/trunk/; revision=15264
2005-06-16From Paul Ollis:Anders Broman1-506/+649
epan/sigcomp_state_hdlr.c epan/sigcomp_state_hdlr.h --------------------------------------------------- Function udvm_state_access: 1. Removed the state_vars_valid parameter. It is no longer used. 2. The function now correctly updates each of state_length, state_address and state_instruction with saved state value. [Previously this was only done for state referenced in the SigComp message header.] 3. Removed code that (incorrectly) read byte_copy_left from UDVM memory within the loop that writes the state to UDVM memory. 4. Removed the code that set the useful values in UDVM memory. This should only be done for state referenced in the SigComp message header. (The decompress_sigcomp_message function, sets the useful values.) epan/sigcomp-udvm.c epan/sigcomp-udvm.h --------------------------------------- Function decompress_sigcomp_message: 1. Added three new parameters; header_len, byte_code_state_len, byte_code_id_len. The byte_code_state_len and byte_code_id_len are used to set the useful values in UDVM memory. The header_len is required to calculate the cycles available for decompression. 2. Various minor corrections to spellings, etc in generated messages. 3. Reduced the number of lines of output for print_level_1. Now the execution trace shows the instruction name and parameter values on one line. [This was done because, we found that even at the lowest level of detail ethereal became unusably slow; running on a 500 MHz SPARC. This seems to be related to the number of lines produced by the SigComp trace, which can easily be over 1000 with the modified code.] 4. Removed the used of some floating point functions. In all cases they were unnecessary and could potentially cause the code to produce the wrong results on some platforms (although this is unlikely). 5. The useful values are now set correctly, using the new byte_code_state_len and byte_code_id_len parameters. 6. The message header length is now included in the calculation of maximum_UDVM_cycles. Previously, the calculation could underestimate the value, resulting in the (small) chance that some legitimate messages might fail to decompress. Note: The calculation might now slightly over-estimate the cycles but this is a reasonable thing to do. 7. Implemented the PUSH, POP, CALL and RETURN instructions. Note: The two SORT instructions and the CRC and SHA-1 instructions are still not implemented. 8. The COPY and COPY-LITERAL instructions now apply the byte-copying-rules to the source address as well as the destination address. 9. The COPY-LITERAL and COPY-OFFSET now correctly handle the destination operand. Previously, it was possible for the destination to be left at byte_copy_right when it should be left at byte_copy_left. 10. All three COPY instructions will now behave correctly if the source or destination start at byte_copy_right; i.e. they read/write to byte_copy_right, byte_copy_right+1, etc. Previously the parameters would wrap to byte_copy_left. 11. The COPY-OFFSET instruction now correctly calculates the source address for all values of offset. Previously a very large offset (greater than the circular buffer size) could cause the starting position to be mis-calculated. 12. Modulo 65536 arithmetic has been added in some places where it was missing. [Only when noticed, we have not been able to check all the code.] 13. Some redundant code was removed for the INPUT-BITS instruction. Also, INPUT-BITS (0, x, x) now correctly discards spare bits when the P-bit, has changed. 14. Corrected the cycles used calculation for the INPUT-BITS instruction. 15. Corrected some minor cases where the used_udvm_cycles was not incremented. [Not really a problem, but it allowed us to verify correctness with some of the SigComp torture tests.] 16. Removed some redundant code in INPUT-HUFFMAN (and reorganised some comments to keep them making sense). Function decomp_dispatch_get_bits: 1. This has been rewritten. The original version could not correctly handle requests for more than 8 bits. The new version is cleaner and correctly handles all cases. svn path=/trunk/; revision=14666