1
1
mirror of https://github.com/wader/fq.git synced 2024-11-24 11:16:09 +03:00
Commit Graph

348 Commits

Author SHA1 Message Date
Mattias Wadman
5d67df47e2 avro_ocf: Fix panic on missing meta schema 2022-07-23 22:20:03 +02:00
Mattias Wadman
8b5cc89641
Merge pull request #334 from wader/hevc_vps-max-vps-layers
hevc_vps,fuzz: Error on too many vps layers
2022-07-22 22:56:31 +02:00
Mattias Wadman
fd302093e1 hevc_vps,fuzz: Error on too many vps layers 2022-07-22 22:48:25 +02:00
Mattias Wadman
e0a391de56
Merge pull request #332 from wader/elf-error-on-large-strtab
elf,fuzz: Error on too large string table
2022-07-22 22:47:33 +02:00
Mattias Wadman
40481f6692 elf,fuzz: Error on too large string table
Fixes alloc/hang of giant string
2022-07-22 22:35:45 +02:00
Mattias Wadman
75169a65b5 asn1: Add regression test for range decode fix ##330 2022-07-22 22:32:37 +02:00
Mattias Wadman
cec2dede92
Merge pull request #330 from wader/mp4-dont-sort-samples
mp4: Don't range sort samples, keep sample table order
2022-07-22 16:46:38 +02:00
Mattias Wadman
c6d0d89c06 mp4: Don't range sort samples, keep sample table order 2022-07-22 16:35:00 +02:00
Mattias Wadman
7537905593
Merge pull request #325 from wader/unbreak-fuzz-test
fuzz: Replace built tag with FUZZTEST env and use new interp api
2022-07-20 18:31:31 +02:00
Mattias Wadman
2464ebc238 fuzz: Replace built tag with FUZZTEST env and use new interp api
Build tag hides build errors
2022-07-20 18:24:07 +02:00
Mattias Wadman
78aa96b0ac dev: Cleanup some code to fix a bunch of new linter warnings 2022-07-19 18:56:09 +02:00
Mattias Wadman
342612eb7e dev: Cleanup linters and fix some unused args 2022-07-19 18:33:50 +02:00
Mattias Wadman
f5be5180f0 interp: Cleanup and clarify some format naming 2022-07-16 22:04:21 +02:00
Mattias Wadman
1ddea1ada3 interp,format: Refactor registry usage and use function helpers
Move registry to interp and add support for functions and filesystems.
This will be used later for allow formats to add own functions and fq code.

Add gojqextra function helpers to have more comfortable API to add functions.
Takes care of argument type casting and JQValue:s and some more things.

Refactor interp package to use new function helper and registry. Probably
fixes a bunch of JQValue bugs and other type errors.

Refactor out some mpeg nal things to mpeg format.

Refactor interp jq code into display.q and init.jq.

Remove undocumented aes_ctr funciton, was a test. Hopefully will add more crypto things laster.
2022-07-16 19:24:13 +02:00
Mattias Wadman
ea2cc3c2ec mp4: Don't decode encrypted samples 2022-07-07 19:02:10 +02:00
Mattias Wadman
64f3e5c717 fairplay: Add basic SPC decoder and PSSH system id 2022-07-07 17:11:55 +02:00
Mattias Wadman
417255b72b bitcoin: Add blkdat, block, transcation and script decoder 2022-07-04 09:59:51 +02:00
Mattias Wadman
f66a359c39 elf: Use correct offset to dynamic linking string table
String table used for "needed" tags (the string seen with ldd etc) was using address as
offset which seem to work as it's usually the same as correct offset. But this is not true
for some ELFs. Then we have to look up offset by finding the section by address and then use
its offset for the string table. Hope this is the correct way.

Not sure how to produce a small test for this.
2022-06-30 23:30:56 +02:00
Mattias Wadman
a6a97136b7 decode: Cleanup Try<f>/<f> pairs
Decode API design is that Try* returns error non-Try panics.
Also rename Must* as they should panic and introduce some new Try* functions
that were missing.
2022-06-30 12:13:46 +02:00
Mattias Wadman
0863374f8c doc: Correct bencode spec URL
Also rename _tojq value_sep to object_sep and fix formats_diagram.jq to use tomd5
2022-06-13 18:49:34 +02:00
Mattias Wadman
7d25fbfdbb mp4: Properly use trun data offset
Each trun has it's own data offset, before the last offset was wrongly used
for all truns. Could also cause sample ranges to be beyond EOF.

tenc: Decode default constant iv

Fixes #292
2022-06-07 17:43:45 +02:00
Mattias Wadman
c92f4f13c1 matroska: Update ebml_matroska.xml and allow unknown ids
Update spec from https://raw.githubusercontent.com/ietf-wg-cellar/matroska-specification/master/ebml_matroska.xml
Allow unknown ids, decodeas "unknown" type with just binary data
Change "type" field to just a string, there is no type id number.
Make all type field symbols consistently lowercase
2022-06-06 21:43:42 +02:00
Mattias Wadman
6b00297edd mp4,senc: Refactor current track/moof tracking and add senc box support
Keep track of curren using box data stack instead of refrences in the context.
2022-06-03 21:13:49 +02:00
Mattias Wadman
3b717c3ba4 interp: Add to/from<encoding> for some common serialzations, encodings and hashes
Add toxml/fromxml for XML encoding, mighe be lossy on ordering
fromxml has {seq:bool} to add #seq attributes to improve ordering
toxml has {indent:number} to choose space indent depth

Add tojson, same as in jq but also has {indent:number} options

Add toyaml/fromyaml for YAML

Add totoml/fromtoml for TOML

Add tojq/fromjq for jq-flavored JSON (optional quotes for keys, comments and trailing commas support)

Add tocsv/fromcsv for CSV
formcvs takes {comma:string, comment:string} for custom separtor and comment character

Rename/split hex into tohex/fromhex
Rename/split base64 into tobase64/frombase64
tobase64/frombase64 takes {encoding:string} option for base64 flavour (std, url, rawstd, rawurl)

Add to/from<format> urlpath, urlquery, url, xmlentities, base64, hex

Add to<hash> md4, md5, sha1, sha256, sha512, sha3_224, sha3_256, sha3_384, sha3_512

Add to/from<encoding> iso8859-1, utf8, utf16, utf16le, utf16be
2022-05-28 16:31:20 +02:00
Mattias Wadman
7b27e506f1 mp4,bitio: Fix broken pssh decoding and add proper reader cloning to bitio
PSSH decoding probably got broken in some refactoring. system id is 16 bytes,
also scalar mapper should use cloned reader to not affect reader which in the case
broke reading system id bytes.

Add test with playread and widevine pssh boxes

Related to #282
2022-05-28 13:42:38 +02:00
Mattias Wadman
aa694e3f20 zip: s/Decompress/Uncompress/ 2022-05-26 19:36:06 +02:00
Mattias Wadman
47350e46a6 zip: Add uncompress=false test and some docs 2022-05-26 16:39:01 +02:00
Mattias Wadman
8021492197 interp: help: Fix incorrect options example 2022-05-26 12:52:51 +02:00
Mattias Wadman
e641274487 zip: Add zip64 support and uncompress option
{uncompress:boolean} uncompress and probe, default true
2022-05-26 12:46:50 +02:00
Mattias Wadman
377af133e0 fqtest: Cleanup path usage
Make cwd for a test script the directory where the script is.
Use relative paths
2022-05-21 20:03:25 +02:00
Mattias Wadman
e9d9f8aef9 fq: Use go 1.18
Rename s/interface{}/any/g
Preparation for using generics in decode API and native jq funcations etc
Remove some unused linter ignores as linter has been fixed
2022-05-20 15:23:16 +02:00
Mattias Wadman
7bfa88cdb5
Merge pull request #271 from wader/mp3-cleanup
mp3: Use d.FieldValueU and some cleanup
2022-05-20 13:15:31 +02:00
Mattias Wadman
3780375d76 mp3: Use d.FieldValueU and some cleanup 2022-05-20 12:50:40 +02:00
Mattias Wadman
2dc509ab2f interp: Refactor dump and revert #259 for now
Causes address bar to not be shown in some cases.
Will have to rethink and redo the whole dump thing somehow.
2022-05-20 12:38:43 +02:00
Mattias Wadman
ba844eb06a mp4: Skip fields for pcm samples for now
Will produce one field per sample which is a bit too much.
Maybe in some future fq can have smart array types that could handle this better.

Also add data_format per track to make it easier to understand things.
2022-05-19 16:00:42 +02:00
Mattias Wadman
5109df4a50 interp: dump: Show address bar for nested roots
Hopefully makes it a bit easier to read and spot
2022-05-11 00:00:39 +02:00
Mattias Wadman
903c7198b4
Merge pull request #258 from wader/mp4-mvhd-tkhd-mdhd-mehd-version1
mp4: mvhd,tkhd,mdhd,mehd: Add version 1 support
2022-05-10 00:48:47 +02:00
Mattias Wadman
2e328180ae mp4: mvhd,tkhd,mdhd,mehd: Add version 1 support
Also fix incorrect mehd decode
2022-05-10 00:21:04 +02:00
Mattias Wadman
efa5e23aaa icc_profile: Correctly clamp align padding on EOF
Also code was mixing bytes and bit units, how could this have worked?
2022-05-09 13:14:20 +02:00
Mattias Wadman
8228ecaeee mp4: Add track id field and add track for tfhd with unseen track_id
Fragmened mp4s can have no tkhd box or tkhd box with a track_id that does not match
any tfhd box track_id. Make is possible to see samples for these fragmented tracks
ny adding tracks for unseen track_ids.

Also add id field for tracks.
2022-05-08 19:02:21 +02:00
Mattias Wadman
76161a1b99 scalar,mp4,gzip,tar: Add timestamp to description
Scalar api for this needs some work
2022-05-07 13:15:13 +02:00
Mattias Wadman
9133f0e527 scalar: Add *Fn type to map value and clearer naming
Should replace most of this with generics at some point
2022-05-07 12:46:34 +02:00
Mattias Wadman
34cf5442b3 tcp: Split into client/server structs and add skipped_bytes and has_start/end per direction
Feels clenaer and removes _client/server field prefixes
2022-05-06 16:52:18 +02:00
Mattias Wadman
51ea1a31b9
Merge pull request #250 from wader/wav-bencode-random-fixes
wav,bencode: Random fixes
2022-05-05 20:21:16 +02:00
Mattias Wadman
1aaaefb0ac wav,bencode,mpeg_ps_packet,id3v1: Random fixes
wav: Rest of file should description not symbolic value
bencode: Remove redundant torepr example
mpeg_ps_packet,id3v1: Remove whitespace in symbolic value
2022-05-05 19:45:05 +02:00
Mattias Wadman
0e02bb669c mp4: iinf: Only assume sub boxes for version 0 2022-05-04 15:35:00 +02:00
Mattias Wadman
b0096bc170 avc_pps: Correct check if there is more rbsp data
Also add rbsp_stop_one_bit field
2022-05-04 12:34:40 +02:00
Mattias Wadman
c4dd518e04 decode: Make compound range sort optional
Some formats might want to control child order
mp4: Keep tracks in track id order
dns: Keep label component order
elf: Keep seciton order
macho: Keep command and section order
2022-05-03 16:16:09 +02:00
Mattias Wadman
3ce660a2cf decode: Keep decode tree on RangeFn error 2022-05-03 10:57:43 +02:00
Mattias Wadman
f4480c6fe5 decode,interp: Support for format specific options
interp: Refactor format help and also include options
interp: Add -o name=@path to load file content as value (not documented yet, might change)
interp,decode: Expose decode out value as _out (might change)
interp: Refactor foramts.jq into format_{decode,func,include}.jq
interp: Refactor torepr into _format_func for generic format function overloading
interp: Refactor -o options parsing to be more generic and collect unknowns options to be used as format options
decode of decode alises
func for format overloaded functions
include for format specific jq functions (also _help, torepr etc)
flac_frame: Add bits_per_sample option
mp3: Add max_unique_header_config and max_sync_seek options
mp4: Add decode_samples and allow_truncate options
avc_au: Has length_size option
hevc_au: Has length_size option
aac_frame: Has object_typee option
doc: Rewrite format doc generation, less hack more jq
2022-05-01 17:08:30 +02:00