Skip to content

276. Base slot 13's wide sizes the state variable storage, and everything above it is painted with 0xFE at every boot

A device this project composed and wrote to the spare Harmony One appeared on the activity menu, beeped when pressed and started nothing. The cause is base slot 13's header: composeDevice raised the section's count when it appended a variable and left the other two words alone, so the container declared 52 variables and declared the storage large enough for 51. The remote sizes that storage from the words it was given and fills everything above it with 0xFE at every boot, and the one variable the whole activity turns on sat in the first two bytes above the line.

It is a new instance of the hazard class this project keeps meeting: a configuration the remote accepts and mishandles. The file parses, both checksums verify, the byte accounting closes with no overlaps, the emitter reproduces it, every reader here agrees the device is there and named, and the remote runs it and does nothing.

Recorded correction, and the reviewer was right. The first version of this section claimed the firmware refuses a write to a variable at or above narrow + wide and that a config's state write is dropped by that check. The bound check is real and it does refuse, and the blind reviewer's caller census refuted the attribution: its callers are host command handlers, and a config's own state write is not bound checked at all. So the write lands and the failure is the fill, which is the half that hardware had already confirmed. The wrong reading came from finding a guard, reading its two callers as the store and the load, and never asking what dispatched them. Two things made it plausible and neither is evidence: the guard sits three instructions in front of the store, and the symptom fits.

Sources checked before the work started

docs/findings.md sections 34, 35 and 138 for the table's header and its seeder, and section 274 for the seeder on all three architectures. The firmware images for arch 12 (Harmony One) and arch 14 (the Harmony 700 reference image), disassembled here. Logitech's own client was not consulted and could not have answered: this is arithmetic inside the interpreter, not a field a host writes.

The header, and which words the firmware keeps

Section 35 read the header and stored the second word as the threshold. Reading the initialiser again shows all four words fetched, the low byte of three of them kept and the fourth stored nowhere: 0x17974 on arch 14 (Harmony 700 reference image), 0x2A264 on arch 12 (Harmony One).

word arch 14 (Harmony 700) arch 12 (Harmony One) what it does
1, count scratch 0x0D2F scratch 0x0D05 the seeding loop's limit, and nothing else
2, narrow 0x1EA 0x187 the one byte to two byte width threshold
3, wide 0x1EB 0x188 sizes the storage, and bounds a host command
4, narrowAgain discarded discarded nothing stores it

Only the low byte of each is kept, so a value above 255 is silently truncated. count goes to a shared scratch byte rather than a retained global, so it does not survive the routine. count is still used, twice, and neither use is a check: it is the limit of the boot loop that seeds each variable from its record, and the entry array's length is 8 + 3 * count. What it never is, is a validity bound on an index, in either image.

That answers half of section 35's open question about why the header repeats narrow: on these two architectures nothing on the remote uses the fourth word. Arch 9 (Harmony 525) reads it, section 274.

The fill, which is the mechanism

Immediately after the seeding loop, 0x17A42 on arch 14 (Harmony 700 reference image) and 0x2A330 on arch 12 (Harmony One):

17a46: MOVF  0x1eb,W     wide
17a48: ADDWF WREG,W      doubled
17a4a: ADDWF 0x1ea,W     plus narrow

narrow + 2 * wide is the storage the variables occupy, which is section 35's own "RAM it occupies" column reached from the code rather than from the table, and it is exactly what the store's own arithmetic needs: below narrow one byte at base + index, at or above it two bytes at base + narrow + 2 * (index - narrow). A loop then writes 0xFE into every byte from that offset upwards. The ceiling is per image rather than per architecture, which is worth stating because the obvious reading is wrong: 0x7F on arch 12 (Harmony One), 0xFF on the Harmony 700 and 0xC0 on the Harmony 600, so two images of the same architecture disagree. The Harmony One paints up to index 126.

There is a second way into the same fill and its start is the constant 18, chosen by a bit of a flags byte: 0x2A33E on arch 12 (Harmony One), 0x17A52 on the Harmony 700, 0x16116 on the Harmony 600, and the bit tested differs too, 3 against 4. So "everything above narrow + 2 * wide" describes the arm that runs on an ordinary boot, and the flag that selects the other arm is unread. On the boot this section measured, the computed arm is the one that ran, because the run begins at the computed byte.

The order is what does the damage. The seeding loop runs first, over count records, through a store that performs no bound check of its own, so record 51 is seeded correctly into the two bytes above the declared storage. The fill runs second and paints over them.

Confirmed on hardware, read only, before anything was rewritten

The spare Harmony One with the offending configuration on it, connected, untouched since its own last boot, data memory from 0x108:

0x108  08 29 0a 07 02 08 1a 01 01 06 03 14 00 00 02 00
0x118  01 00 00 00 01 05 02 00 00 00 00 00 00 00 00 01
0x128  00 00 01 01 00 00 01 00 01 00 00 07 00 00 00 00
0x138  00 00 00 00 01 00 fe fe fe fe fe fe fe fe fe fe

The container declares narrow = 50 and wide = 1, so the storage is 52 bytes and ends at 0x108 + 52 = 0x13C. The 0xFE run begins at 0x13C exactly, and variable 51 is the two bytes 0x13C and 0x13D. So it holds 65278 where its record says 0.

The same read calibrates itself, which is what makes the base address a measurement rather than an assumption: variables 0 to 6 are the clock, section 130, and they read 10:41:08 on day 7, month 8 zero based against a stated maximum of 11, year 26. That is the moment of the read.

The bound check, and what it actually guards

Seven instructions, identical modulo the address of the two globals, and present on every image in the lab: 0x2A694 on arch 12 (Harmony One), 0x17DCA on the Harmony 700 and 0x16466 on the Harmony 600 for arch 14, 0x17BA2 on the 650, 0x04B32 on arch 9 (Harmony 525) and 0x172A4 on arch 16 (Harmony 350). The Harmony One's:

2a694: MOVLB 0x1
2a696: MOVF  0x187,W     narrow
2a698: ADDWF 0x188,W     plus wide
2a69a: SUBWF 0x196,W     minus the index
2a69c: BC    0x2a6a0
2a69e: RETLW 0x01        in range
2a6a0: RETLW 0x00        out of range

Its callers are USB command handlers and not the interpreter, which is this section's recorded correction, and they are commands this project's own protocol table already names:

  • 0x26692, in front of a write, is WRITE_MISC selector 0x01, whose executor this document lists at 0x2668E in its own arch 12 selector table. On failure the store is skipped and the handler reports success anyway.
  • 0x26D24, in front of a read, is READ_MISC selector 0x01. Its two result bytes are cleared before the dispatch, so a refused index comes back as 0, which is indistinguishable from a variable holding 0. The same shape as arch 9's READ_MISC, already recorded.

So the bound protects a host poking a state variable over USB, which is a command we can send: the neighbouring selector 0x07 on the same chain is the RAM write assertRamWriteAllowed guards. Arch 14 (Harmony 700 reference image) has one caller, 0x0CBCC, the read; its write handler carries four selector cases where the Harmony One's carries eight, so on that architecture no write path is bound checked at all. Arch 9 (Harmony 525) has two, 0x02FF8 and 0x03430.

A configuration's own writes take neither path. 0x24F94 on arch 12 (Harmony One) tests opcode >= 0x80, clears bit 7 and reaches the store through 0x2A598, with no bound check; 0x2513C dispatches opcode 0x72 to the load with the index unchecked. Arch 14 (Harmony 700 reference image) is the same at 0x0EC9C and 0x0EE50.

So the bound exists, and what it protects is a host asking the remote to poke a variable over USB. That is worth knowing on its own, because it is a reply this project reads: a refused index comes back as 0 and looks exactly like a variable holding 0.

The closure, and one that was claimed and is not one

  • The arithmetic and the hardware, which is the real one and has nothing in common: the fill's start is computed from two header words in the code, and the 0xFE run on a connected remote begins at that byte and not one either side.
  • The two architectures: the store's width arithmetic, the fill's offset arithmetic and the bound check are the same instructions in both images, differing only in the array base, the addresses of the globals, the fill ceiling and the flags bit tested.
  • The corpus identity is not a closure for the bound, and the first version of this section used it as one. narrow + wide == count on 19 of 19 containers and narrowAgain == narrow on 19 of 19, and on 21 of 21 with the two deliberately outside that population, so the corpus cannot distinguish a bound of count from a bound of narrow + wide: they are the same number in every one. What the identity is evidence for is what generators emit, which is what makes it enforceable. The one generator that has broken it is ours, and its container is excluded from the corpus, so a sentence like "no generator here has ever emitted such a header" would be true only by leaving out the counterexample.

The calibration, and what it scores against

The wrong answer is available and was obtained the expensive way: the container as written, with wide one short, is the only case anywhere in which the two readings of the header come apart. Under "count sizes the storage" the device works; under "narrow + 2 * wide sizes it" the variable is overwritten at every boot. The remote agrees with the second, at the exact byte.

Which architectures this covers

The header reading, the store's width arithmetic and the fill are measured on arch 12 (Harmony One) and on arch 14 on both the Harmony 700 reference image and the Harmony 600's own. The bound routine is on all six images in the lab, including arch 9 (Harmony 525) and arch 16 (Harmony 350), so it is not one architecture's.

Arch 9 (Harmony 525) is scoped more carefully than the first version of this section managed, which said it "is not covered and is known to differ" on section 274's authority. That section's "guards per variable" is about the seeder, a different routine, and generalising it to the bound was wrong: the Harmony 525 carries the identical seven instructions at 0x04B32 with two callers. What is genuinely unmeasured there is the fill, so nothing here says whether a Harmony 525 paints over a variable above its storage.

Arch 8 (Harmony 880 and 885) and arch 10 (Harmony 890 and 895) have no image here at all. The corpus identity holds on all four architectures the corpus carries, which is a claim about generators and not about firmware. Corrected by section 284: arch 8 has two images here, and their seeder fills from the literal 18 at 0x17370 as the others do; arch 10 has none.

What is not established

Why the value does not stick, which the one press experiment made sharper rather than closed. The row was pressed on the connected remote and the two variables the activity's enter list writes behaved differently:

variable what the list writes before after transitions on its record
20, CurrentActivityState_0 8 1 8 0
51, LG_Power 1 0xFE 0xFE 0xFE 0xFE 2

Both are 0x80 | n writes three bytes apart in the same list, so the list ran. Variable 20's record seeds to 6 and it reads 8, which is also what rules the cable out as an explanation: the boot routine seeds every variable and then fills, in that order in one function, so had reconnecting re-run it variable 20 would have been reset. It was not.

And the store has no bound check, so nothing on the path accounts for this. 0x24F94 strips bit 7 and calls 0x2A598, which loads the old value, stores the new one unconditionally, and then hands both to the transition machinery by way of 0x2A74E, which fetches the variable's own record out of base slot 13 by index. Traced instruction by instruction, and the wide arm's arithmetic lands on 0x13C exactly.

So there are two facts and no mechanism joining them: the byte holds the sentinel after a press that should have written it, and no refusal exists on the path. Three candidates, none tested. The transition machinery may restore a value when no transition matches, which would fit the table above and rests on two variables. 0x2A234, which the store calls and whose answer it keeps, is unread. And a third fill site may exist that the two found here do not account for.

What is not in doubt is that the activity could not have started. The record's transitions are 0 to 1 and 1 to 0, the variable was holding 65278, and a transition is what runs the power list. That is enough to explain the beep and nothing happening, and it does not depend on which of the three candidates is right.

The corrected configuration was written, and the byte level prediction held exactly

Written to the spare Harmony One on 7 September 2026, 25 blocks, every erase with both neighbours read before and after, the whole configuration reading back byte for byte identical to the file, and the remote restarting itself. Data memory from 0x108 immediately afterwards:

before the write after it
variable 51 at 0x13C 0xFE 0xFE 00 00, seeded from its record
where the 0xFE run starts 0x13C 0x13E

narrow + 2 * wide moved from 52 to 54, so the boundary moved by exactly two bytes and the variable it had been sitting on is now inside the storage. A second instrument agrees the remote is running this file: its clock read 13:07:49 against the container's own build stamp of 13:07:23, which is section 111's reseeding of the clock from base slot 3 at boot, so the boot happened and it read our bytes.

Then the row was pressed and variable 51 read 01 00, with the clock showing no restart in between. So the write lands, the variable holds what the activity puts there, and the whole of this section's mechanism is confirmed on hardware.

And the television still did not respond, which is a different finding

The activity beeps, sets its counter and sets the television's power variable to 1 from 0, which is exactly the transition its own record declares, and no code goes out. So this section closes the header defect and does not close the activity.

What the corpus says, and it is a shape no configuration here contains. Across the fourteen programmed configurations, counting every variable's record:

carry transitions
variables below narrow, one byte 91 of 194
variables at or above narrow, two bytes 0 of 64

So Logitech's generator has never put a transition on a two byte variable, and composeDevice now does exactly that, because raising wide is what keeps the header consistent when the pointer is appended at the end. The calibration case is direct: the real activity on this same remote drives its television through TV_Power, variable 36, which is below narrow and carries the same two transitions in the same shape, and it works.

Whether the width is the cause is not established. The transition walker at 0x2A37A on arch 12 (Harmony One) reads the record's count and then each entry's from and to as 16 bit values, and nothing in the part read branches on the variable's width. So what is measured is a 0 of 64 absence and a working narrow counterexample, not a refusal.

What follows for the composer is that appending the pointer is the wrong end. Inserting it at narrow makes the variable a one byte one and matches all 91 working cases, and it costs what this section's fix section rejected it for: every variable at or above narrow shifts up by one, and those are referenced. On the four programmed arch 12 (Harmony One) containers the single top wide variable is written by an action list 3 times and read 22 to 40 times, so a composer that inserts there has to rewrite those references rather than only the header. That is the next piece of work, and it is todo.md 1.2.5.

Why wide exists at all, given that count - narrow would give it. A separate word lets the two disagree and nothing treats that as an error, so it is redundancy without a check. Worse than redundant: count drives the seeding loop and wide sizes the storage, so a disagreement makes the remote seed variables it then erases.

What count > narrow + wide costs beyond the fill. The seeding loop runs on count through an unchecked store, so a larger gap would write further above the storage before the fill covered it, and what lives there is unread.

What the guarded host command is. Its operands arrive through a buffer fetch and its results leave through a byte appender; which USB command carries it is unread.

The fix, and where it lands

composeDevice appends its pointer at the end of the entry list, so the new index is at or above narrow and the variable is a wide one: wide is the word that has to move, and it now does, with narrow and narrowAgain left alone so nothing already in the table is renumbered.

Inserting at narrow instead would give a one byte variable and reproduce the commonest shape, exactly one wide variable at the top: 16 of 19 containers, and not the property of three architectures it first looked like, since three of the sixteen are arch 14 containers and only two arch 14 containers are the many wide kind.

It is rejected because it renumbers every variable at or above narrow, and the corpus says those are in use rather than spare. Two measurements, both against the reviewer's own count rather than this composer's: on the three many wide containers there are 19 variables above narrow on the Harmony 600 and 27 on each Harmony 700 config, all named, several of them the delay variables. And even where there is only one, the top wide variable is written by an action list on 8 of the 19, the four arch 8 (Harmony 880 and 885) containers and the four programmed arch 12 (Harmony One) ones, through the 0x1F band write and a 0x70 update rather than through 0x80 | n. It is unnamed on 19 of 19, which is what made it look spare. So renumbering it would silently repoint instructions that already exist, and two bytes of storage is much the cheaper price.

  • docs/config-format.md, base slot 13, where the header's three live words are marked as such.
  • packages/codec/src/sections.ts: assertStateTableConsistent, a refusal beside the reader whose header it checks, thrown as StateTableError.
  • packages/corpus/bin/write-config.ts, alongside assertQueueFits, which is the last point at which either silent failure can be caught, plus both compose scripts.
  • packages/codec/test/sections.test.ts: the identity over all 19 containers with the exact split counts, and both arms of the refusal against a deliberately corrupted header.
  • packages/codec/test/compose.test.ts: the four architecture composer test asserts that count and wide each rise by one, that narrow does not move, and that the new index is inside the storage.
  • CLAUDE.md's table of rails and .claude/skills/writing-a-config/SKILL.md.

Section 275 | the archive | section 277. Section 276 of the findings archive, which is frozen; the reference holds the current answer. The archive on GitHub.