Commit Graph

55 Commits

Author SHA1 Message Date
Evan Huus 05e7c6ac59 mp4: handle missing timescale
Avoid various divide-by-zeros when there are durations with no timescale
set. Also fix a rare potential memory leak while I'm here.
2021-07-22 16:35:30 +00:00
Evan Huus d6d7dd1e56 First pass pinfo->pool conversion
Automated find/replace of wmem_packet_scope() with pinfo->pool in all
files where it didn't cause a build failure.

I also tweaked a few of the docs which got caught up.
2021-07-21 05:38:29 +00:00
Guy Harris e1d9a226a2 Fix the type of arrays of pointers to hf_ values for bitfield routines.
The static arrays are supposed to be arrays of const pointers to int,
not arrays of non-const pointers to const int.

Fixing that means some bugs (scribbling on what's *supposed* to be a
const array) will be caught (see packet-ieee80211-radiotap.c for
examples, the first of which inspired this change and the second of
which was discovered while testing compiles with this change), and
removes the need for some annoying casts.

Also make some of those arrays static while we're at it.

Update documentation and dissector-generator tools.

Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc
Reviewed-on: https://code.wireshark.org/review/37517
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-19 11:32:26 +00:00
Martin Kaiser 1702b922d0 mp4: remove _U_ for a parameter which is used
This fixes a -Wused-but-marked-unused compiler warning.

Change-Id: I6a4b5a98237bdb1573bb893eeea2b510d7780f06
Reviewed-on: https://code.wireshark.org/review/36701
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-04-05 08:29:42 +00:00
Alexis La Goutte 498644ef61 mp4(file): Fix Dead Store
Fix dead store (Dead assignement/Dead increment) Warning found by Clang

Change-Id: I4f07d18cef039d671ca3bbade8ca956be1341b56
Reviewed-on: https://code.wireshark.org/review/36082
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-18 09:34:41 +00:00
Jakub Adam c7281ca42c mp4: dissect Chunk Offset Box (stco)
Change-Id: I138ff276e7b095f42325bc10e730f624b4bbd1ef
Reviewed-on: https://code.wireshark.org/review/35939
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-27 18:46:04 +00:00
Jakub Adam 8228b0bc0f mp4: dissect Sample To Chunk Box (stsc)
Change-Id: I14c349f1a9811355f6f41c4518bc6161d2d6cca0
Reviewed-on: https://code.wireshark.org/review/35938
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-27 18:45:30 +00:00
Jakub Adam 3351effd06 mp4: improve Sample Size Box (stsz) dissection
* Describe what sample size == 0 means.
* Show an index next to each table entry.
* Table indices start from 1 according to the specification.

Change-Id: I106188051e6618c3b85fa4945facfe4fedd1987b
Reviewed-on: https://code.wireshark.org/review/35937
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-27 18:45:00 +00:00
Jakub Adam d2dcb9ee7b mp4: dissect Edit List Box (elst)
Change-Id: I350a87cfccdff4bf117d6f84c575ed5282ee573a
Reviewed-on: https://code.wireshark.org/review/35936
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-27 18:44:30 +00:00
Jakub Adam 3b0bdd9e57 mp4: improve Movie Header Box (mvhd) dissection
Display movie duration in seconds. The number of duration units in one
second is determined by timescale parameter.

Change-Id: Ie61e4365f7f751a6d23eff0b3bc9b170b499e60a
Reviewed-on: https://code.wireshark.org/review/35935
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-27 18:43:53 +00:00
Jakub Adam 239273e925 mp4: fix Sample Size Box (stsz) dissection
'stsz' extends FullBox, so it has 'version' and 'flags' fields.

Change-Id: Ibaf99e80ef0ff17104a81da73c08a06acc011173
Reviewed-on: https://code.wireshark.org/review/35932
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-27 18:43:21 +00:00
Jakub Adam 16c9c18e36 mp4: dissect edts box
Change-Id: I01ceaac38a9c59c2546a96fff419510f2289c62f
Reviewed-on: https://code.wireshark.org/review/35931
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-27 18:42:54 +00:00
Jakub Adam db1db08b83 mp4: dissect ctts box
Change-Id: I4a8c5d0eb29feef2577535e2dd7c0a14408bfb84
Reviewed-on: https://code.wireshark.org/review/35930
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-27 18:42:32 +00:00
Jakub Adam 9247ae9757 mp4: dissect stts box
Change-Id: If6ad1aadf8ef5901490047f07513578ad3d5d1a9
Reviewed-on: https://code.wireshark.org/review/35889
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-27 18:41:29 +00:00
Jakub Adam 82ed8918ab mp4: factor out FullBox dissection
Avoid repeating code dealing with dissection of version and flags fields
that ISO/IEC 14496-12 defines in FullBox class.

Change-Id: I72cb4072c8bb41a670d41187692dd72697dd1049
Reviewed-on: https://code.wireshark.org/review/35888
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-26 19:26:21 +00:00
Jakub Adam 41be9b9c5d mp4: tkhd times are encoded as ENC_TIME_CLASSIC_MAC_OS_SECS
Change-Id: I4be6639c469e01a2f6b1bbe9d4a8bc65ea44f836
Reviewed-on: https://code.wireshark.org/review/35905
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-26 19:23:56 +00:00
Guy Harris fc31446277 Add support for "classic Mac OS" timestamps and use them in file-mp4.c.
Those times are in seconds since January 1, 1904, 00:00:00 (proleptic?)
UTC.

MPEG-4 Part 14 (MP4) is based on QuickTime, so it uses classic Mac OS
time stamps, in seconds.

Change-Id: Ibcd7faf1b119d8acbb294c95b66ca0d1fb70cbb3
Reviewed-on: https://code.wireshark.org/review/35886
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-01-21 20:54:25 +00:00
Stig Bjørlykke 1fccffdaea mp4: Fix uint64 printf format
Use G_GUINT64_FORMAT for uint64.

Change-Id: I2c839f1637d088d905c22e615bdf35fe967827d6
Reviewed-on: https://code.wireshark.org/review/35885
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2020-01-21 09:43:39 +00:00
Jakub Adam b5ef0847dc mp4: dissect Track Header Box (tkhd) flags
Change-Id: Id1f035ccc571fe29effb8344b05f4b2b564374bb
Reviewed-on: https://code.wireshark.org/review/35876
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-21 04:46:24 +00:00
Jakub Adam bd645093e5 mp4: display timestamps in human-readable format
Change-Id: Ic8ef5d835b8263b747c856e7a3c66701547d07e7
Reviewed-on: https://code.wireshark.org/review/35875
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-21 04:46:16 +00:00
Jakub Adam ce8e6e1c95 wiretap: Add MP4 reader
Allows opening MP4 (ISO/IEC 14496-12) media files in Wireshark and
viewing their structure.

Change-Id: Ie20b8b89dc69bb52d6faa890e547d90317adecf6
Reviewed-on: https://code.wireshark.org/review/35804
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-01-14 20:04:01 +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
Martin Kaiser 620f69a74b mp4: limit the recursion depth for boxes
Although the dissection of each box header consumes a couple of bytes,
it turned out that it's still possible to crash wireshark with a sample
file that contains a large number of nested boxes. The stack will fill
up before we reach the end of the data bytes.

Keep track of the recursion depth as we walk through the hierarchy of
boxes. Abort if we reach the (locally defined) upper limit.

Bug: 13777
Change-Id: I0f67245a5c74131f10d0f9d99b39ad31711b9775
Reviewed-on: https://code.wireshark.org/review/26167
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-28 22:33:51 +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
Michael Mann a869ec6f55 Adjust proto_tree_add_[float|double]_format_value calls to use unit string
Several calls to proto_tree_add_[float|double]_xxx could be better served
using BASE_UNIT_STRING with a "unit string" in hf_ field.

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

Change-Id: Id0da7b579403898d20c2667d6c4abcd59d5a48d4
Reviewed-on: https://code.wireshark.org/review/19241
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-13 22:56:36 +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 443a7ed259 new_create_dissector_handle -> create_dissector_handle for dissector directory.
Some of the ASN.1 dissectors still generate a new_create_dissector_handle from the tool itself, so leave those for now.

Change-Id: Ic6e5803b1444d7ac24070949f5fd557909a5641f
Reviewed-on: https://code.wireshark.org/review/12484
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09 12:37:36 +00:00
Tyson Key fbd81bfd6f Associate the file-mp4 dissector with the audio/mp4 MIME type
Bug:11338
Change-Id: Ied463ea5ef65bcc657e09c0d5f7983cb4dcd581a
Reviewed-on: https://code.wireshark.org/review/9503
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-07-05 21:35:54 +00:00
Guy Harris 59b4ab53fc Include <math.h> or <stdlib.h> as necessary to declare functions.
Various floating-point math functions require <math.h>, and abs()
requires <stdlib.h>.

Change-Id: I6831cfdb17eac3ce129b6800f0fe82fbcfef2d28
Reviewed-on: https://code.wireshark.org/review/6002
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-22 21:52:08 +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
Alexis La Goutte 9187456045 MP4: Fix Dead Store (Dead assignement/Dead increment) warning found by Clang > 3.3
Change-Id: I0befc8846b9af43e1563adb369ba4d332775ef76
Reviewed-on: https://code.wireshark.org/review/5778
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-12-15 22:12:26 +00:00
Alexis La Goutte 82e63040b6 MP4: fix Unused entry: epan/dissectors/file-mp4.c, hf_mp4_stsd_entry_cnt
Change-Id: I95f0ab387570c0c56e19990cb9b9063051bb792f
Reviewed-on: https://code.wireshark.org/review/5779
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2014-12-15 22:05:26 +00:00
Martin Kaiser 0a30f6878d start dissecting the stsz box
Change-Id: Ia8fce9307bae33c44d630af403980d162afd88c2
Reviewed-on: https://code.wireshark.org/review/5597
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-12-03 21:31:01 +00:00
Martin Kaiser 2f39f2e8aa BOX_TYPE_STZ2
Change-Id: I4eadf2b613b7803c81593e517408631f8375ab2c
Reviewed-on: https://code.wireshark.org/review/5596
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-12-03 21:30:36 +00:00
Martin Kaiser ee48194705 start dissecting the mvhd box
Change-Id: I66c1973daa89690f6aaa10891408e93e886875ea
Reviewed-on: https://code.wireshark.org/review/5595
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-12-03 21:30:18 +00:00
Michael Mann 6fad7d19e7 Eliminate proto_tree_add_text from some dissectors.
Some other related cleanup.

Change-Id: I45f54032aa8318858f4ee784945b6f2ed163b6ea
Reviewed-on: https://code.wireshark.org/review/4328
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-09-27 15:44:53 +00:00
Alexis La Goutte f1dd9bc62a Fix Dead Store (Dead assignement/Dead increment) warning found by Clang
Change-Id: I19df790d18e71d45df28dc6e8731cd2e1acb098b
Reviewed-on: https://code.wireshark.org/review/3826
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-08-25 14:43:15 +00:00
Martin Kaiser cca0fd35fe add the flags to all FullBoxes
Change-Id: I6e0109bc1d1acf200fd0c1a9f8ddd3a3d98f5908
Reviewed-on: https://code.wireshark.org/review/3189
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-07-24 20:01:47 +00:00
Martin Kaiser 0b15ec8cdc start dissecting the MP4 stsd box
Change-Id: I589a6ced098d1d224e86386f028c92fc0797164e
Reviewed-on: https://code.wireshark.org/review/3188
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-07-24 20:01:20 +00:00
Martin Kaiser fb9851ea57 dissect the MP4 url box
Change-Id: Ibeaf5ba5d104e7f9bc9291e83923f8675abf0099
Reviewed-on: https://code.wireshark.org/review/3187
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-07-24 20:00:41 +00:00
Martin Kaiser 7d219fdd7d dissect the MP4 dref box
Change-Id: I342f283bbab3052337e00502769150cf3f4a8800
Reviewed-on: https://code.wireshark.org/review/3186
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-07-24 20:00:11 +00:00
Martin Kaiser 476f49cd0f dissect the MP4 hdlr box
Change-Id: I467bfae2db7d3a119b58505b43b3d9bb59615ee9
Reviewed-on: https://code.wireshark.org/review/3185
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-07-24 19:59:34 +00:00
Bill Meier 9ed99d5c4e Strip some trailing whitespace; Fix some indentation; Add editor-modelines as needed.
Change-Id: I943153e28f468070d86535abad7be032e1386118
Reviewed-on: https://code.wireshark.org/review/2994
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-07-11 03:20:54 +00:00
Michael Mann f5e2b4293d convert to proto_tree_add_subtree[_format]
Change-Id: I358bfaa4e5d40cd01b766f614f8bd0dbaf611dd0
Reviewed-on: https://code.wireshark.org/review/2508
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-22 14:34:17 +00:00
Martin Kaiser 254e227266 dissect more components of the track header box
Change-Id: If8d35122ce096f52837bdff1c6599b47456697d5
Reviewed-on: https://code.wireshark.org/review/1858
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-05-29 17:29:41 +00:00
Martin Kaiser 0ec20c3019 brackets around MAKE_TYPE_VAL's definition
Change-Id: I8e080b250b81976898d2950da9e91fb32b719590
Reviewed-on: https://code.wireshark.org/review/756
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-20 19:59:22 +00:00
Martin Kaiser 48f6b800ae (nearly empty) function to dissect the body of a track header box
Change-Id: I17e4bb3968e503b250b9c8d6a7a9bb2abf0f6868
Reviewed-on: https://code.wireshark.org/review/755
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-20 19:59:04 +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
Martin Kaiser 5c825d6a36 mp4 box type is always a 7bit ascii string
svn path=/trunk/; revision=54881
2014-01-21 22:16:05 +00:00