Commit graph

419 commits

Author SHA1 Message Date
Aidan MacDonald
e8faf2f2ad buflib: add a common dummy callbacks struct & use it
There are various allocations that can't be moved or shrunk.
Provide a global callback struct for this use case instead of
making each caller declare its own dummy struct.

Also fixed ROLO and x1000 installer code which incorrectly
used movable allocations.

Change-Id: I00088396b9826e02e69a4a33477fe1a7816374f1
2022-02-12 10:24:32 -05:00
Aidan MacDonald
1ad60c3344 x1000-installer: remove redundant overflow check
This overflow is impossible to trigger due to the simple
relationship between binary and hexadecimal numbers.

Change-Id: Ie8243129967abb935a77152a808765318052c979
2021-11-28 15:46:06 +00:00
Aidan MacDonald
c086a3386f x1000-installer: map filenames accept only valid characters
Instead of using isgraph(), check for legal FAT32 characters
excluding spaces (which are used as field separators).

Change-Id: I291f0acb5f24c558099c237d913f4f35ae06b834
2021-11-28 15:46:06 +00:00
Aidan MacDonald
31242f8570 x1000-installer: add test for xf_map_parseline
Change-Id: I35db43c83dc3964607b95f6b5c300c2fef455ac8
2021-11-28 15:46:02 +00:00
Aidan MacDonald
4879891da3 x1000-installer: xf_stream_read_lines bugfixes
- Only treat EOF as newline if the line is non-empty to
  suppress a useless empty line after the end of a file.
- Deal with 0- and 1-byte line buffers safely.
- Remove whitespace stripping and comment handling which
  was left over from refactoring. Move it to xf_map_parse()
  where it belongs.

Change-Id: I9f05f4e18ca6dd011ca4cd231f0b5ea37c784778
2021-11-28 13:55:48 +00:00
Aidan MacDonald
420d545018 x1000-installer: tests for xf_stream.c
Change-Id: Ib9d1ca0109029f09ff0f8adfc10925c7c9a0f8b9
2021-11-28 13:55:43 +00:00
Aidan MacDonald
b027063c03 x1000-installer: simple test suite runner
Change-Id: I0b9ee81cbd8dda593924b2f7c32a1d1d87ce84b0
2021-11-28 13:45:20 +00:00
Aidan MacDonald
7ca8623927 x1000-installer: add test & code coverage support to makefile
Pass COVERAGE=1 to enable clang-based code coverage and pass
SANITIZE=1 to enable sanitizers. 'make cov' will run the test
app and show a coverage summary.

Change-Id: I8a33e8b78665165d8da1818dc01f495f0c52cf06
2021-11-28 13:45:20 +00:00
Aidan MacDonald
06423cab58 x1000-installer: Initial commit of new framework
This is a new flash installer framework for the X1000 targets.

A bunch of this code is *UNTESTED* but there is an external test
harness which allows the library to be built and tested on a PC.

Once tests are written and the bugs are ironed out this framework
will replace the existing installer code.

New features:

- Update tarballs are MD5-checksummed to guarantee integrity.
- The flash map is no longer fixed -- updates are self describing and
  carry a map file which specifies the areas to update.
- Can take full or partial backups with checksums computed on the fly.
- Supports an additional verification mode which reads back data after
  writing to ensure the flash contents were not silently corrupted.

Change-Id: I29a89190c7ff566019f6a844ad0571f01fb7192f
2021-11-27 15:28:19 -05:00
Aidan MacDonald
c1709e3194 microtar: Update to latest upstream commit
This is a major overhaul of the library with some API
changes and ease of use improvements, particularly for
creating new archives.

The updated functionality is intended to support a new
X1000 installer framework.

Change-Id: Icf192bb546831231d49303fbf529ef1c1ce8905c
2021-11-27 13:13:35 +00:00
William Wilgus
235e41578b metadata/mp3data.c init vars & add sanity checks
Change-Id: Idface0ea73c4a6f0d46a57bddf77db9475a972f4
2021-08-11 22:40:09 -04:00
William Wilgus
30945f1180 metadata/metadata_common.c check read for proper bytes read
Change-Id: I25d7c20d449cde4d5cfd3f57e00ff45f4c14f60b
2021-08-11 22:25:20 -04:00
William Wilgus
f05a7a10a6 metadata/metadata_common.c WS changes
Change-Id: Ieef86e94676c603a21cbb5af55e63ba628a09cdf
2021-08-11 22:16:19 -04:00
William Wilgus
7aa0e0a898 metadata/asf.c ensure variable init & add sanity checks
Change-Id: If4432549b843cafb000c3fedee12184d75da595b
2021-08-11 22:06:15 -04:00
William Wilgus
e3e72d6dba metadata/mp4.c fix small oversight / bug
didn't set the genre string to null on case entry
means read failure would leave genre string indeterminate

add explicit NULL & leave genre uninitialized

Change-Id: I1452a0b57985646c982ec80755d0df9d03745f1e
2021-08-11 08:29:02 -04:00
William Wilgus
c9e9558044 metadata/mp4.c check for read errors skip buffer appropriately
WIP

Change-Id: I770f0d911f7d9826e89d886892ff3913661a8151
2021-08-11 01:36:32 +00:00
William Wilgus
275c762bb2 As3525 wavpack_enc document some intentional switch fall through
Change-Id: I56bf439df2c05653d65f49238e886e4ef2291176
2021-08-08 09:27:27 -04:00
William Wilgus
0a6d7abd13 metadata/asap.c consolidate read char function and check return values
and a bit of cleanup using macros to make the code easier to follow

Change-Id: I2c5953a68a9f415453e508c14a9c1a5a1e84e6b5
2021-08-07 17:13:09 -04:00
William Wilgus
da778a1783 metadata/asap.c WS cleanup
Change-Id: Id3bc053a45eeea107a54dd47640fa3ceb4b04498
2021-08-07 17:07:32 -04:00
William Wilgus
57293f1fd9 metadata/vfx.c cleanup string and character handling
Change-Id: I7550d6db05b0d31a1433d0af9b2233f9dc3f5ee2
2021-08-07 04:50:14 +00:00
William Wilgus
603e749c1d metadata/smaf.c handle read errors
Change-Id: I450f1fc8e1b69ce09f9888f5384c3e23a93822a1
2021-08-07 02:53:28 +00:00
William Wilgus
8a8fd3d4a3 metadata/mp3data.c set data to 0 in case of read error
Change-Id: I15d4e3d3be4bf4531c892f4351355b0b2e8e0ca9
2021-08-06 20:55:11 -04:00
Aidan MacDonald
6b1b7b6016 Fix use of uninitialized variable in mp4 metadata parser
Change-Id: Idca69e7429af13609785755d4e152d87f471c462
2021-08-06 16:10:41 +00:00
Solomon Peachy
9f0f2c6658 metadata: Fix sign extension in get_uint64_le() routine
Change-Id: Ibd85cf72ac1babd1fa636c341b90b76bdfc0491b
2021-08-05 13:44:39 +00:00
William Wilgus
848633f921 lib/skin_parser check that malloc succeeded
Change-Id: I32db233a53b0f693f815cf96bcbe6711c366e5b3
2021-08-05 10:38:18 +00:00
Aidan MacDonald
005c414e5f Document intentional fallthroughs + fix harmless unintended ones
Change-Id: I1ca5b1027ec30cbf61093bab35b980196ed14e6b
2021-08-04 18:59:46 +00:00
William Wilgus
0501af8b06 metadata/flac.c fix potential buffer overrun
Change-Id: Iee12f251455c4fda9d91d10e466d17e5e02046b9
2021-08-02 03:00:01 +00:00
William Wilgus
247731fe8c id3tags.c check for buffer overrun
Change-Id: I74fde8e234fe85abfabefddcea7f10038167c715
2021-08-01 22:29:14 -04:00
Aidan MacDonald
2e9443104f rbcodec: Fix typo in makefile
Hopefully this will fix all those random build failures.

Change-Id: I02ff625c538a21f20b33874b4ab54ed8c893a433
2021-07-25 15:55:36 +01:00
William Wilgus
363f6595b4 tlsf make ~0 explicitly unsigned ~0u
Change-Id: Ib3220df24fee470416ef813b89bdc5f27e455af7
2021-07-22 23:23:51 +00:00
Solomon Peachy
144d1b1e81 misc: Fix up a few warnings uncovered by LTO
* direct use of memcpy() instead of ci->memcpy() in flac and mod
 * uninitialized variable in mpegplayer

Change-Id: I2d08682d5f66c319780e69e3ff63d600c61d8f5a
2021-07-15 18:37:42 +00:00
Solomon Peachy
2e9b93dc5d build: Nuke the ASMFLAGS workaround for gcc 3.4.x
Change-Id: I0f21e9539d39afd54916fa8d84ce798eef474a2c
2021-07-08 20:47:30 -04:00
Solomon Peachy
2ff3425ab1 build: Rename SHARED_LDFLAG to SHARED_LDFLAGS
Change-Id: Icb81c72fbcfcdad624112a386ba38a40a830d18f
2021-07-08 19:53:05 -04:00
Solomon Peachy
2ed4bf8a43 FS#13299: Handle MP3 files with more than 128K of headers before audio data
Encountered a file with ~600K of ID3v1 headers.

Optimize the potential overhead by minimizing reverse seeks.

Change-Id: I972dbf1af1c36659f19c7ab4eed0b9149c642880
2021-06-16 17:37:29 -04:00
Solomon Peachy
fa9ddd5af9 Revert "FS#13299: Simplify VBR frame parsing in the metadata decoder."
This reverts commit 756c0d2ac8.

Change-Id: I5f98972f69e7645239fd9218c9d4eeb9bd2ec7a5
2021-06-16 16:58:47 -04:00
Solomon Peachy
756c0d2ac8 FS#13299: Simplify VBR frame parsing in the metadata decoder.
The old code would seek forward by the frame length, expecting to see a
frame header there, perform a validity check, and then seek back to the
current header.

Unfortunately this doesn't handle situations where there is extra padding
between the frames, leading us to potentially read garbage, causing the
validity tests to fail and rejecting the file outright.

Instead, keep track of the previous valid header/position, and if we find
"valid" headers in a row return the first after seeking back to it.

This change allows the file referenced in FS13299 to be properly parsed, but
further work is needed to get the file to be playable.  (file reports itself
as layer 1, variable bit rate, variable sample rate!)

Change-Id: I85f61a6360cc041a172db4b7a6b5516e5b60ceee
2021-06-13 12:13:03 -04:00
Solomon Peachy
942b1dd072 FS13094: Fix a divide-by-zero crash parsing zero-length WMA/ASF files
Change-Id: I2e90692327c69c4467a586b23b877c596b8d2c40
2021-05-12 18:22:06 -04:00
Aidan MacDonald
9a19360398 Add microtar library (for use by M3K bootloader)
This is an MIT-licensed library for reading and writing v7 format
tar files. The version here is my fork, which fixes security issues
in the original code (it hasn't been updated in 4 years, probably
abandoned by the author).

Change-Id: I86d41423dacc46e9fa0514b4fc7386a96c216e86
2021-05-12 11:30:13 +01:00
William Wilgus
14c6bb798d Sync opus codec to upstream git
Change-Id: I0cfcc0005c4ad7bfbb1aaf454188ce70fb043dc1
2021-04-23 14:23:04 +00:00
amachronic
0fb333c85e rbcodec: Fix typo in include guard
Change-Id: I503ace58fb46e803c66b92113d2be7daebeb8b71
2021-04-06 17:27:06 +01:00
Christian Soffke
a8846e3003 Increase id3v2 max item size on high mem targets
As per multiple user requests:
https://forums.rockbox.org/index.php/topic,53319.msg

The acceptable size for id3v2 fields currently maxes out at
240 bytes on targets with more than 2MB of memory.

The comments field, especially for Podcasts, can sometimes
contain significantly more characters than Rockbox allows.

The limit for devices with more than 8MB of memory
is increased to 500 bytes for individual fields, and
to 1800 bytes for the buffer containing all fields.

Change-Id: I4593372229158756f102f67bcc4a43e64f632d58
2021-03-22 02:50:51 +00:00
Solomon Peachy
2628155fc9 Clean up places that use #if defined(CPU_ARM | CPU_COLDFIRE | CPU_MIPS)
Since that encompasses _all_ of our native targets in a post-archos world,
either replace it with #if (CONFIG_PLATFORM & PLATFORM_NATIVE) or
delete it altogher as appropriate.

Change-Id: I9128a456e850d5c96a9e05806aad3acd923f90c5
2021-03-04 14:14:33 +00:00
William Wilgus
2cde135cfe flac fix dumb typo
Change-Id: Ic6269ca35374bcb1d6a5ad2c1848a1718fa4e01c
2021-03-03 02:58:34 +00:00
William Wilgus
118191479d Nudge flac towards upstream FS#13266 -- Fix the Yellow still?
Change-Id: I76056b1a682db055857d759d2ebffae111a8a4c0
2021-03-02 19:47:07 -05:00
William Wilgus
2252bde144 Nudge flac towards upstream FS#13266 -- Fix Yellow
unused variables

Change-Id: I69e1435941da6207c75d0f3cb862dee296a5cc1a
2021-03-02 19:20:39 -05:00
William Wilgus
a017219488 Nudge flac towards upstream FS#13266
Some flac encoded files contain junk that our decoder
picked up

upstream has some sign and overflow fixes too

Change-Id: I5857b2fe56906a48f04944cdfee8fe2306f2c3fd
2021-03-02 23:48:05 +00:00
Solomon Peachy
7418ec5009 FS#13267: Fix crash when enabling Perceptual Bass Enhancment during playback
I think the assumption is that during playback, the DSP is already running
so it assumes PBE needs to be flushed before it is properly enabled.

Change-Id: I2bac3d02c80f97c8d9ce26a575175f6344a8e86a
2021-03-01 19:02:22 +00:00
Solomon Peachy
670812a44a Support MP3 audiostreams embedded in ASF containers.
Full credit to Igor Poretsky

Change-Id: I54769e33665cada1e1e0ef3a5511b56c8e1b859a
2021-02-28 16:11:54 +00:00
Solomon Peachy
bdc3dd4fca MP4: append mdat sections together in metadata parser
mp4 files can have multiple 'mdat' chunks.  This is common for
audiobooks, where there is often a secondary mdat containing the
chapter names, but it's also legal to have multiple mdat chunks
for a single logical "track"

This confuses the mp4 metadata parser, which assumes there is
only a single mdat, and always uses the last mdat seen to
determine the "filesize" of the data we're trying to decode.

Work around this by appending each mdat's size to result in the final
"filesize"

Change-Id: I3e7a7efb0f05ef965e8d77f79e450c957524a480
2021-02-19 13:35:41 +00:00
Solomon Peachy
621e363e70 libgme: Fix yellow in hosted MIPS builds
Change-Id: I6d25c014cc519ddc5d1619c25d48331f512c2f2f
2020-10-28 07:30:10 -04:00