Commit Graph

40 Commits

Author SHA1 Message Date
John Thacker 787ecb7f1d file-jpeg: Reduce expert info to PI_PROTOCOL for Exif
Change the expert info for Exif files that have Exif instead
of JFIF in their first identifier fields from a PI_MALFORMED
to PI_PROTOCOL. It's not the correct protocol spec, but it's
common in Exif files and it doesn't make the dissector give up,
so PI_PROTOCOL is more appropriate.
2022-08-09 19:37:03 -04:00
João Valverde 8efad466c4 Tools: Fix fix-encoding-args.pl ASCII string validation
Do not require a useless ENC_NA parameter for string encodings.
FT_STRING and FT_STRINGZ types don't have any ndianness.

Follow-up to 6ec429622c.
2022-02-15 11:38:16 +00:00
Martin Mathieson a690119080 Fix some too-narrow field types. 2022-02-02 10:01:03 +00:00
Martin Mathieson 62a747bae3 file-jpeg: Fix value in vals_ifd_tags_exif[] 2021-12-18 11:43:03 +00:00
Роман Донченко a027211ea2 jpeg: Implement dissection for Exif-specific IFDs 2021-12-12 07:29:31 +00:00
Роман Донченко e5e2974546 jpeg: Don't create an unnecessary dummy tree item
Exif does not define the order of elements in the Exif data, so if there's
empty space in front of IFD #0, it might be used for other IFDs or standalone
values.

As such, don't create a dummy tree item covering that space.
2021-12-12 07:29:31 +00:00
Роман Донченко be38ad12ab jpeg: refactor the parsing of Exif data
After the recent updates, the `process_app1_segment` function has grown very
large. Split it into three functions and make some extra improvements:

* Indent continuation lines consistently.

* Give variables more descriptive names (e.g. no more `val_16`, `val_32`).

* Remove the need to do arithmetic with the `tiff_start` (and the variable
  itself) by using a subset TVB for the TIFF data.

* Remove unnecessary return values.

* Make miscellaneous style improvements.

There should be no difference in behavior, except that the error message
associated with `ei_next_ifd_offset` now shows the correct number (previously
the number was `offset + tiff_start`, when it should have been
`offset - tiff_start`; with the removal of `tiff_start` this bug got fixed
by itself).
2021-12-06 06:08:29 +00:00
João Valverde 19dcb725b6 epan: Remove STR_ASCII and STR_UNICODE
These display bases work to replace unprintable characters so the
name is a misnomer. In addition they are the same option and this
display behaviour is not something that is configurable.

This does not affect encodings because all our internal text strings
need to be valid UTF-8 and the source encoding is specified using
ENC_*.

Remove the assertion for valid UTF-8 in proto.c because
tvb_get_*_string() must return a valid UTF-8 string, always, and we
don't need to assert that, it is expensive.
2021-12-03 04:35:56 +00:00
Роман Донченко 9afa7413f1 jpeg: implement dissection of large Exif IFD values
That is, those that don't fit in the offset field. This includes support
for RATIONAL/SRATIONAL types.
2021-11-29 09:11:04 +00:00
Роман Донченко e116110f0c jpeg: add support for dissecting inline IFD values
In many cases, the "value offset" is actually the value itself.
Handle those cases correctly.
2021-10-15 04:53:03 +00:00
Роман Донченко 05512b0428 jpeg: correct the IFD tag for the Copyright field
It is supposed to be 0x8298 according to both the TIFF and Exif specs.
2021-09-24 20:32:29 +03:00
Роман Донченко 1848fa71ed jpeg: fix typos in variable names
IFD is the structure these variables refer to, and is short for
Image File Directory.
2021-09-24 17:46:20 +03:00
Роман Донченко 141e3b331f jpeg: place each IFD in a subtree
An Exif file typically contains 2 IFDs, and this makes them easier to tell
apart.
2021-09-24 12:04:03 +00:00
Guy Harris 1b54c40a5b jpeg: don't free something allocated from a wmem pool.
If it's allocated with the NULL "pool", yes - that's just a regular
allocation - but if it's allocated from a pool, no.
2021-08-19 15:59:43 -07:00
David Perry 6e8c7283d6 Change some `wmem_packet_scope()` to `pinfo->pool` 2021-07-27 21:36:43 +00:00
Anders Broman 2b7975db54 Fix Wpointer-sign warnings.
Change-Id: I69a266bc945441bc9351b97bd1de0af7f9be46a0
Reviewed-on: https://code.wireshark.org/review/37768
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-07 12:16:46 +00:00
Martin Mathieson 5ed4f53e2b Fix a few broken web links from dissectors
Change-Id: I008a9136890354aae583aaaf9ccf9213d5efe539
Reviewed-on: https://code.wireshark.org/review/37189
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2020-05-13 19:42:53 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Dario Lombardo fe219637a6 dissectors: use SPDX identifiers.
Change-Id: I92c94448e6641716d03158a5f332c8b53709423a
Reviewed-on: https://code.wireshark.org/review/25756
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-12 16:49:58 +00:00
Stig Bjørlykke 9d1f2efa51 Use col_append_sep_str() for fixed strings
Change from col_append_sep_fstr() to col_append_sep_str() when
appending strings without formatting.

Change-Id: I315aca9b815c204a5bc78f7326402c40d1325f0e
Reviewed-on: https://code.wireshark.org/review/20846
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-04-02 16:40:28 +00:00
Michael Mann b585c7275b file-jpeg.c - Pacify pre-commit hooks by removing macro
IMG_JFIF was trying to be a macro for all display and expert info filters.
This messed with the pre-commit scripts ability to ensure protocol
filter name was being used as the prefix for display and expert info
filters.  So replaced IMG_JFIF with the proper prefix - "image-jfif"

Change-Id: I1fe3dc8797529c9d17f75c511bc279824e7e69b0
Reviewed-on: https://code.wireshark.org/review/19253
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-14 03:52:43 +00:00
Michael Mann b7f4e25059 Adjust proto_tree_add_uint_format_value calls to use unit string
Several calls to proto_tree_add_uint_format_value could be better served
using BASE_UNIT_STRING with a "unit string" in hf_ field.  There also
a few cases where proto_tree_add_uint_format_value could just be
proto_tree_add_uint.

Added a few more "common" unit string values to unit_strings.[ch]

Change-Id: Iaedff82c515269c9c31ab9100dff19f5563c932d
Reviewed-on: https://code.wireshark.org/review/19242
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-13 22:56:50 +00:00
Joerg Mayer c0e48778b7 Fix some warnings/errors of type
git/epan/dissectors/packet-a21.c:478:25: error: 'item' was marked unused but was used
      [-Werror,-Wused-but-marked-unused]
        proto_item_append_text(item, "%s", val_to_str_const(event_id, a21_event_vals, "Unknown"));
                               ^
Added manual change id because file-jpeg.c forced the use of commit -n

Change-Id: Iffff53d6253758c8454d9583f0a11f317c8390cb
Reviewed-on: https://code.wireshark.org/review/14666
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-03-28 11:43:56 +00:00
Michael Mann 31a54708f4 new_register_dissector -> register_dissector for dissector directory.
Change-Id: Ie39ef054a4a942687bd079f3a4d8c2cc55d5f22c
Reviewed-on: https://code.wireshark.org/review/12485
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09 12:38:06 +00:00
Michael Mann 21e5a950ad Remove all preferences related to enabling/disabling heuristic dissectors.
The preferences are still supported for backwards compatibility, but the heuristic_protos file has final say on the "preference" to enable/disable a heuristic dissector.

Also add parameter to heur_dissector_add() for the "default" enable/disable of a heuristic dissector. With this parameter, a few more (presumably weak) heuristic dissectors have been "registered" but of course default to being disabled.

Change-Id: I51bebb2146ef3fbb8418d4f5c7f2cb2b58003a22
Reviewed-on: https://code.wireshark.org/review/9610
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-17 17:12:22 +00:00
Michael Mann be7d295fbf Add "user presentable" and "unique string ids" to heuristic table entries.
This allows better presentation of heuristic dissectors to the end user.

Change-Id: I2ff3985ab914e83c2989880cc0c7b9904045b3f6
Reviewed-on: https://code.wireshark.org/review/9602
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-12 03:14:38 +00:00
Michael Mann 639fd7d60d Eliminate proto_tree_add_text from some dissectors.
"file" dissectors are now rid of proto_tree_add_text.

Change-Id: I4e0f7248135e6ce194fcafde47e538db84b964aa
Reviewed-on: https://code.wireshark.org/review/8828
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-08 04:34:00 +00:00
Martin Kaiser ecdaa11f50 jpeg: remove some more unnecessary initialisations
Change-Id: If66a3951037d01c1aa502c0695ea11c62cc4d208
Reviewed-on: https://code.wireshark.org/review/8633
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2015-05-25 16:31:20 +00:00
Martin Kaiser 1e5ca4fc6a jpeg: replace an empty switch-case with a todo comment
Change-Id: I656fa2f69453916dd5466265220e2b4590d3631c
Reviewed-on: https://code.wireshark.org/review/8632
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2015-05-25 16:30:59 +00:00
Martin Kaiser 73ef7b06ef jpeg: some more code cleanup
delete unnecessary initialisations
declare variables at the start of a function

Change-Id: Ib427790c51c1fc7433d0f3c17dc9fa4748585180
Reviewed-on: https://code.wireshark.org/review/8631
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2015-05-25 16:30:23 +00:00
Martin Kaiser e37a8050b6 jpeg: clean up the sos header dissection
Change-Id: Id3e6258036112a64e4111d0483c572697681eb89
Reviewed-on: https://code.wireshark.org/review/8625
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2015-05-25 14:58:01 +00:00
Martin Mathieson a58cf528fc file-jpeg: Allow 'Exif' as identification in first App block, but flag as expert info warning if seen
Change-Id: Id16e0b4fbca3b29b01138a9aea758b8beb8d9ed8
Reviewed-on: https://code.wireshark.org/review/7042
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-02-09 14:19:36 +00:00
Martin Mathieson d8d2d8e09c jpeg: Add handling for comment marker
Change-Id: I10ad7021f6535d65d88faf734fb5800e4415a811
Reviewed-on: https://code.wireshark.org/review/6759
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-01-23 16:00:26 +00:00
Martin Mathieson 596669f921 First batch of unincludes. Last attempt...
Change-Id: I3681462aeb98ca62ed3ec5eb226b2553317391a9
Reviewed-on: https://code.wireshark.org/review/5997
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-22 21:03:13 +00:00
Bill Meier b5d7b7ab6e Cleanup use of #includes in non-generated epan/dissector/*.c
Specifically:
- Set packet.h to be the first wireshark #include after
   config.h and "system" #includes.
   packet.h added as an #include in some cases when missing.
- Remove some #includes included (directly/indirectly) in
   packet.h. E.g., glib.h.
   (Done only for those files including packet.h).
- As needed, move "system" #includes to be after config.h and
   before wireshark #includes.
- Rework various #include file specifications for consistency.
- Misc.

Change-Id: Ifaa1a14b50b69fbad38ea4838a49dfe595c54c95
Reviewed-on: https://code.wireshark.org/review/5923
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-21 05:46:22 +00:00
Bill Meier 0b18d6cb77 Add editor modelines; Adjust whitespace as needed.
Change-Id: I6e70c933ae61a97377235d67b2f6a1b3d67dc155
Reviewed-on: https://code.wireshark.org/review/4484
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-05 20:19:02 +00:00
Dario Lombardo 971ffd683e Fixup: tvb_get_string(z) -> tvb_get_string(z)_enc
Change-Id: I63a3704effe3fcab01a193dc39b6a22e9f1cf3fe
Reviewed-on: https://code.wireshark.org/review/2376
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:13:58 +00:00
Michael Mann 73217d9f3f tvb_new_subset -> tvb_new_subset_length when length parameters are equal.
tvb_new_subset -> tvb_new_subset_remaining it appears that's what the intention is.

Change-Id: I2334bbf3f10475b3c22391392fc8b6864454de2d
Reviewed-on: https://code.wireshark.org/review/1999
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-06-07 15:41:07 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(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>
2014-03-04 14:27:33 +00:00
Michal Labedzki 2c28c5d93f MIME: Rename image dissectors to file dissectors.
Change-Id: Ie160733ceeed23ff96ddccfbf0ca2e7694789ff8
2014-01-29 23:17:33 +01:00